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/browser_tabstrip.h" | 6 #include "chrome/browser/ui/browser_tabstrip.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 11 matching lines...) Expand all Loading... |
22 GURL cached_page = test_server()->GetURL("cachetime"); | 22 GURL cached_page = test_server()->GetURL("cachetime"); |
23 std::string redirect = "server-redirect?" + cached_page.spec(); | 23 std::string redirect = "server-redirect?" + cached_page.spec(); |
24 ui_test_utils::NavigateToURL(browser(), cached_page); | 24 ui_test_utils::NavigateToURL(browser(), cached_page); |
25 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(redirect)); | 25 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(redirect)); |
26 | 26 |
27 int response_start = 0; | 27 int response_start = 0; |
28 int response_end = 0; | 28 int response_end = 0; |
29 content::RenderViewHost* render_view_host = | 29 content::RenderViewHost* render_view_host = |
30 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); | 30 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); |
31 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractInt( | 31 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractInt( |
32 render_view_host, | 32 render_view_host, L"", |
33 "", | 33 L"window.domAutomationController.send(" |
34 "window.domAutomationController.send(" | 34 L"window.performance.timing.responseStart - " |
35 " window.performance.timing.responseStart - " | 35 L"window.performance.timing.navigationStart)", &response_start)); |
36 " window.performance.timing.navigationStart)", | |
37 &response_start)); | |
38 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractInt( | 36 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractInt( |
39 render_view_host, | 37 render_view_host, L"", |
40 "", | 38 L"window.domAutomationController.send(" |
41 "window.domAutomationController.send(" | 39 L"window.performance.timing.responseEnd - " |
42 " window.performance.timing.responseEnd - " | 40 L"window.performance.timing.navigationStart)", &response_end)); |
43 " window.performance.timing.navigationStart)", | |
44 &response_end)); | |
45 EXPECT_LE(response_start, response_end); | 41 EXPECT_LE(response_start, response_end); |
46 } | 42 } |
OLD | NEW |