summaryrefslogtreecommitdiff
path: root/chromium/content/browser/dom_storage/dom_storage_browsertest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/browser/dom_storage/dom_storage_browsertest.cc')
-rw-r--r--chromium/content/browser/dom_storage/dom_storage_browsertest.cc52
1 files changed, 52 insertions, 0 deletions
diff --git a/chromium/content/browser/dom_storage/dom_storage_browsertest.cc b/chromium/content/browser/dom_storage/dom_storage_browsertest.cc
new file mode 100644
index 00000000000..79955a8bf17
--- /dev/null
+++ b/chromium/content/browser/dom_storage/dom_storage_browsertest.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/path_service.h"
+#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/common/dom_storage/dom_storage_types.h"
+#include "content/public/common/content_paths.h"
+#include "content/public/test/browser_test_utils.h"
+#include "content/shell/shell.h"
+#include "content/test/content_browser_test.h"
+#include "content/test/content_browser_test_utils.h"
+#include "net/base/net_util.h"
+
+namespace content {
+
+// This browser test is aimed towards exercising the DOMStorage system
+// from end-to-end.
+class DOMStorageBrowserTest : public ContentBrowserTest {
+ public:
+ DOMStorageBrowserTest() {}
+
+ void SimpleTest(const GURL& test_url, bool incognito) {
+ // The test page will perform tests then navigate to either
+ // a #pass or #fail ref.
+ Shell* the_browser = incognito ? CreateOffTheRecordBrowser() : shell();
+ NavigateToURLBlockUntilNavigationsComplete(the_browser, test_url, 2);
+ std::string result =
+ the_browser->web_contents()->GetLastCommittedURL().ref();
+ if (result != "pass") {
+ std::string js_result;
+ ASSERT_TRUE(ExecuteScriptAndExtractString(
+ the_browser->web_contents(),
+ "window.domAutomationController.send(getLog())",
+ &js_result));
+ FAIL() << "Failed: " << js_result;
+ }
+ }
+};
+
+static const bool kIncognito = true;
+static const bool kNotIncognito = false;
+
+IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, SanityCheck) {
+ SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kNotIncognito);
+}
+
+IN_PROC_BROWSER_TEST_F(DOMStorageBrowserTest, SanityCheckIncognito) {
+ SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kIncognito);
+}
+
+} // namespace content