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 "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 6 #include "chrome/browser/ui/tabs/tab_strip_model.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/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "content/public/test/browser_test_utils.h" | 10 #include "content/public/test/browser_test_utils.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 contents, | 38 contents, |
39 "window.domAutomationController.send(" | 39 "window.domAutomationController.send(" |
40 " JSON.stringify(after))", | 40 " JSON.stringify(after))", |
41 &after)); | 41 &after)); |
42 EXPECT_EQ(before, after); | 42 EXPECT_EQ(before, after); |
43 } | 43 } |
44 }; | 44 }; |
45 | 45 |
46 IN_PROC_BROWSER_TEST_F(LoadtimesExtensionBindingsTest, | 46 IN_PROC_BROWSER_TEST_F(LoadtimesExtensionBindingsTest, |
47 LoadTimesSameAfterClientInDocNavigation) { | 47 LoadTimesSameAfterClientInDocNavigation) { |
48 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 48 ASSERT_TRUE(embedded_test_server()->Start()); |
49 GURL plain_url = embedded_test_server()->GetURL("/simple.html"); | 49 GURL plain_url = embedded_test_server()->GetURL("/simple.html"); |
50 ui_test_utils::NavigateToURL(browser(), plain_url); | 50 ui_test_utils::NavigateToURL(browser(), plain_url); |
51 content::WebContents* contents = | 51 content::WebContents* contents = |
52 browser()->tab_strip_model()->GetActiveWebContents(); | 52 browser()->tab_strip_model()->GetActiveWebContents(); |
53 ASSERT_TRUE(content::ExecuteScript( | 53 ASSERT_TRUE(content::ExecuteScript( |
54 contents, "window.before = window.chrome.loadTimes()")); | 54 contents, "window.before = window.chrome.loadTimes()")); |
55 ASSERT_TRUE(content::ExecuteScript( | 55 ASSERT_TRUE(content::ExecuteScript( |
56 contents, "window.location.href = window.location + \"#\"")); | 56 contents, "window.location.href = window.location + \"#\"")); |
57 ASSERT_TRUE(content::ExecuteScript( | 57 ASSERT_TRUE(content::ExecuteScript( |
58 contents, "window.after = window.chrome.loadTimes()")); | 58 contents, "window.after = window.chrome.loadTimes()")); |
59 CompareBeforeAndAfter(); | 59 CompareBeforeAndAfter(); |
60 } | 60 } |
61 | 61 |
62 IN_PROC_BROWSER_TEST_F(LoadtimesExtensionBindingsTest, | 62 IN_PROC_BROWSER_TEST_F(LoadtimesExtensionBindingsTest, |
63 LoadTimesSameAfterUserInDocNavigation) { | 63 LoadTimesSameAfterUserInDocNavigation) { |
64 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 64 ASSERT_TRUE(embedded_test_server()->Start()); |
65 GURL plain_url = embedded_test_server()->GetURL("/simple.html"); | 65 GURL plain_url = embedded_test_server()->GetURL("/simple.html"); |
66 GURL hash_url(plain_url.spec() + "#"); | 66 GURL hash_url(plain_url.spec() + "#"); |
67 ui_test_utils::NavigateToURL(browser(), plain_url); | 67 ui_test_utils::NavigateToURL(browser(), plain_url); |
68 content::WebContents* contents = | 68 content::WebContents* contents = |
69 browser()->tab_strip_model()->GetActiveWebContents(); | 69 browser()->tab_strip_model()->GetActiveWebContents(); |
70 ASSERT_TRUE(content::ExecuteScript( | 70 ASSERT_TRUE(content::ExecuteScript( |
71 contents, "window.before = window.chrome.loadTimes()")); | 71 contents, "window.before = window.chrome.loadTimes()")); |
72 ui_test_utils::NavigateToURL(browser(), hash_url); | 72 ui_test_utils::NavigateToURL(browser(), hash_url); |
73 ASSERT_TRUE(content::ExecuteScript( | 73 ASSERT_TRUE(content::ExecuteScript( |
74 contents, "window.after = window.chrome.loadTimes()")); | 74 contents, "window.after = window.chrome.loadTimes()")); |
75 CompareBeforeAndAfter(); | 75 CompareBeforeAndAfter(); |
76 } | 76 } |
OLD | NEW |