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 "net/test/test_server.h" | 10 #include "net/test/test_server.h" |
11 | 11 |
12 class LoadtimesExtensionBindingsTest : public InProcessBrowserTest { | 12 class LoadtimesExtensionBindingsTest : public InProcessBrowserTest { |
13 public: | 13 public: |
14 LoadtimesExtensionBindingsTest() { | 14 LoadtimesExtensionBindingsTest() {} |
15 EnableDOMAutomation(); | |
16 } | |
17 | 15 |
18 void CompareBeforeAndAfter() { | 16 void CompareBeforeAndAfter() { |
19 // TODO(simonjam): There's a race on whether or not first paint is populated | 17 // TODO(simonjam): There's a race on whether or not first paint is populated |
20 // before we read them. We ought to test that too. Until the race is fixed, | 18 // before we read them. We ought to test that too. Until the race is fixed, |
21 // zero it out so the test is stable. | 19 // zero it out so the test is stable. |
22 content::RenderViewHost* rvh = | 20 content::RenderViewHost* rvh = |
23 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); | 21 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); |
24 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 22 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
25 rvh, L"", | 23 rvh, L"", |
26 L"window.before.firstPaintAfterLoadTime = 0;" | 24 L"window.before.firstPaintAfterLoadTime = 0;" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 ui_test_utils::NavigateToURL(browser(), plain_url); | 62 ui_test_utils::NavigateToURL(browser(), plain_url); |
65 content::RenderViewHost* rvh = | 63 content::RenderViewHost* rvh = |
66 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); | 64 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); |
67 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 65 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
68 rvh, L"", L"window.before = window.chrome.loadTimes()")); | 66 rvh, L"", L"window.before = window.chrome.loadTimes()")); |
69 ui_test_utils::NavigateToURL(browser(), hash_url); | 67 ui_test_utils::NavigateToURL(browser(), hash_url); |
70 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 68 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
71 rvh, L"", L"window.after = window.chrome.loadTimes()")); | 69 rvh, L"", L"window.after = window.chrome.loadTimes()")); |
72 CompareBeforeAndAfter(); | 70 CompareBeforeAndAfter(); |
73 } | 71 } |
OLD | NEW |