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 "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/test/base/in_process_browser_test.h" | 7 #include "chrome/test/base/in_process_browser_test.h" |
8 #include "chrome/test/base/ui_test_utils.h" | 8 #include "chrome/test/base/ui_test_utils.h" |
9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
10 #include "content/public/common/content_paths.h" | 10 #include "content/public/common/content_paths.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 return net::FilePathToFileURL( | 26 return net::FilePathToFileURL( |
27 dir.Append(FILE_PATH_LITERAL("dom_storage")).Append(file_name)); | 27 dir.Append(FILE_PATH_LITERAL("dom_storage")).Append(file_name)); |
28 } | 28 } |
29 | 29 |
30 void SimpleTest(const GURL& test_url, bool incognito) { | 30 void SimpleTest(const GURL& test_url, bool incognito) { |
31 // The test page will perform tests then navigate to either | 31 // The test page will perform tests then navigate to either |
32 // a #pass or #fail ref. | 32 // a #pass or #fail ref. |
33 Browser* the_browser = incognito ? CreateIncognitoBrowser() : browser(); | 33 Browser* the_browser = incognito ? CreateIncognitoBrowser() : browser(); |
34 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 34 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
35 the_browser, test_url, 2); | 35 the_browser, test_url, 2); |
36 std::string result = the_browser->GetSelectedWebContents()->GetURL().ref(); | 36 std::string result = the_browser->GetActiveWebContents()->GetURL().ref(); |
37 if (result != "pass") { | 37 if (result != "pass") { |
38 std::string js_result; | 38 std::string js_result; |
39 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( | 39 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( |
40 the_browser->GetSelectedWebContents()->GetRenderViewHost(), L"", | 40 the_browser->GetActiveWebContents()->GetRenderViewHost(), L"", |
41 L"window.domAutomationController.send(getLog())", &js_result)); | 41 L"window.domAutomationController.send(getLog())", &js_result)); |
42 FAIL() << "Failed: " << js_result; | 42 FAIL() << "Failed: " << js_result; |
43 } | 43 } |
44 } | 44 } |
45 }; | 45 }; |
46 | 46 |
47 static const bool kIncognito = true; | 47 static const bool kIncognito = true; |
48 static const bool kNotIncognito = false; | 48 static const bool kNotIncognito = false; |
49 | 49 |
50 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheck) { | 50 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheck) { |
51 SimpleTest(GetTestURL("sanity_check.html"), kNotIncognito); | 51 SimpleTest(GetTestURL("sanity_check.html"), kNotIncognito); |
52 } | 52 } |
53 | 53 |
54 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheckIncognito) { | 54 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheckIncognito) { |
55 SimpleTest(GetTestURL("sanity_check.html"), kIncognito); | 55 SimpleTest(GetTestURL("sanity_check.html"), kIncognito); |
56 } | 56 } |
OLD | NEW |