OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "content/browser/web_contents/web_contents_impl.h" | 6 #include "content/browser/web_contents/web_contents_impl.h" |
7 #include "content/common/dom_storage/dom_storage_types.h" | 7 #include "content/common/dom_storage/dom_storage_types.h" |
8 #include "content/public/common/content_paths.h" | 8 #include "content/public/common/content_paths.h" |
9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
10 #include "content/public/test/browser_test_utils.h" | 10 #include "content/public/test/browser_test_utils.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 void SimpleTest(const GURL& test_url, bool incognito) { | 23 void SimpleTest(const GURL& test_url, bool incognito) { |
24 // The test page will perform tests then navigate to either | 24 // The test page will perform tests then navigate to either |
25 // a #pass or #fail ref. | 25 // a #pass or #fail ref. |
26 Shell* the_browser = incognito ? CreateOffTheRecordBrowser() : shell(); | 26 Shell* the_browser = incognito ? CreateOffTheRecordBrowser() : shell(); |
27 NavigateToURLBlockUntilNavigationsComplete(the_browser, test_url, 2); | 27 NavigateToURLBlockUntilNavigationsComplete(the_browser, test_url, 2); |
28 std::string result = | 28 std::string result = |
29 the_browser->web_contents()->GetLastCommittedURL().ref(); | 29 the_browser->web_contents()->GetLastCommittedURL().ref(); |
30 if (result != "pass") { | 30 if (result != "pass") { |
31 std::string js_result; | 31 std::string js_result; |
32 ASSERT_TRUE(ExecuteScriptAndExtractString( | 32 ASSERT_TRUE(ExecuteScriptAndExtractString( |
33 the_browser->web_contents(), | 33 the_browser, "window.domAutomationController.send(getLog())", |
34 "window.domAutomationController.send(getLog())", | |
35 &js_result)); | 34 &js_result)); |
36 FAIL() << "Failed: " << js_result; | 35 FAIL() << "Failed: " << js_result; |
37 } | 36 } |
38 } | 37 } |
39 }; | 38 }; |
40 | 39 |
41 class MojoDOMStorageBrowserTest : public DOMStorageBrowserTest { | 40 class MojoDOMStorageBrowserTest : public DOMStorageBrowserTest { |
42 public: | 41 public: |
43 void SetUpCommandLine(base::CommandLine* command_line) override { | 42 void SetUpCommandLine(base::CommandLine* command_line) override { |
44 ContentBrowserTest::SetUpCommandLine(command_line); | 43 ContentBrowserTest::SetUpCommandLine(command_line); |
(...skipping 14 matching lines...) Expand all Loading... |
59 | 58 |
60 IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, SanityCheck) { | 59 IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, SanityCheck) { |
61 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kNotIncognito); | 60 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kNotIncognito); |
62 } | 61 } |
63 | 62 |
64 IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, SanityCheckIncognito) { | 63 IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, SanityCheckIncognito) { |
65 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kIncognito); | 64 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kIncognito); |
66 } | 65 } |
67 | 66 |
68 } // namespace content | 67 } // namespace content |
OLD | NEW |