| 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/path_service.h" | 5 #include "base/path_service.h" |
| 6 #include "content/browser/web_contents/web_contents_impl.h" | 6 #include "content/browser/web_contents/web_contents_impl.h" |
| 7 #include "content/public/common/content_paths.h" | 7 #include "content/public/common/content_paths.h" |
| 8 #include "content/public/test/browser_test_utils.h" | 8 #include "content/public/test/browser_test_utils.h" |
| 9 #include "content/shell/shell.h" | 9 #include "content/shell/shell.h" |
| 10 #include "content/test/content_browser_test.h" | 10 #include "content/test/content_browser_test.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 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 = the_browser->web_contents()->GetURL().ref(); | 28 std::string result = the_browser->web_contents()->GetURL().ref(); |
| 29 if (result != "pass") { | 29 if (result != "pass") { |
| 30 std::string js_result; | 30 std::string js_result; |
| 31 ASSERT_TRUE(ExecuteJavaScriptAndExtractString( | 31 ASSERT_TRUE(ExecuteJavaScriptAndExtractString( |
| 32 the_browser->web_contents()->GetRenderViewHost(), | 32 the_browser->web_contents()->GetRenderViewHost(), L"", |
| 33 std::string(), | 33 L"window.domAutomationController.send(getLog())", &js_result)); |
| 34 "window.domAutomationController.send(getLog())", | |
| 35 &js_result)); | |
| 36 FAIL() << "Failed: " << js_result; | 34 FAIL() << "Failed: " << js_result; |
| 37 } | 35 } |
| 38 } | 36 } |
| 39 }; | 37 }; |
| 40 | 38 |
| 41 static const bool kIncognito = true; | 39 static const bool kIncognito = true; |
| 42 static const bool kNotIncognito = false; | 40 static const bool kNotIncognito = false; |
| 43 | 41 |
| 44 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheck) { | 42 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheck) { |
| 45 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kNotIncognito); | 43 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kNotIncognito); |
| 46 } | 44 } |
| 47 | 45 |
| 48 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheckIncognito) { | 46 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheckIncognito) { |
| 49 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kIncognito); | 47 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kIncognito); |
| 50 } | 48 } |
| 51 | 49 |
| 52 } // namespace content | 50 } // namespace content |
| OLD | NEW |