| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test/automation/tab_proxy.h" | 5 #include "chrome/test/automation/tab_proxy.h" |
| 6 #include "chrome/test/ui/ui_test.h" | 6 #include "chrome/test/ui/ui_test.h" |
| 7 #include "googleurl/src/gurl.h" | 7 #include "googleurl/src/gurl.h" |
| 8 #include "net/test/test_server.h" | 8 #include "net/test/test_server.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 class LoadtimesExtensionBindingsUITest : public UITest { | 11 class LoadtimesExtensionBindingsUITest : public UITest { |
| 12 public: | 12 public: |
| 13 LoadtimesExtensionBindingsUITest() | 13 LoadtimesExtensionBindingsUITest() |
| 14 : http_server_(net::TestServer::TYPE_HTTP, FilePath()) { | 14 : http_server_(net::TestServer::TYPE_HTTP, |
| 15 net::TestServer::kLocalhost, |
| 16 FilePath()) { |
| 15 dom_automation_enabled_ = true; | 17 dom_automation_enabled_ = true; |
| 16 } | 18 } |
| 17 | 19 |
| 18 void CompareBeforeAndAfter(TabProxy* tab_proxy) { | 20 void CompareBeforeAndAfter(TabProxy* tab_proxy) { |
| 19 // TODO(simonjam): There's a race on whether or not first paint is populated | 21 // 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, | 22 // before we read them. We ought to test that too. Until the race is fixed, |
| 21 // zero it out so the test is stable. | 23 // zero it out so the test is stable. |
| 22 ASSERT_TRUE(tab_proxy->ExecuteJavaScript( | 24 ASSERT_TRUE(tab_proxy->ExecuteJavaScript( |
| 23 "window.before.firstPaintAfterLoadTime = 0;" | 25 "window.before.firstPaintAfterLoadTime = 0;" |
| 24 "window.before.firstPaintTime = 0;" | 26 "window.before.firstPaintTime = 0;" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 NavigateToURL(plain_url); | 66 NavigateToURL(plain_url); |
| 65 scoped_refptr<TabProxy> tab_proxy = GetActiveTab(); | 67 scoped_refptr<TabProxy> tab_proxy = GetActiveTab(); |
| 66 ASSERT_TRUE(tab_proxy.get()); | 68 ASSERT_TRUE(tab_proxy.get()); |
| 67 ASSERT_TRUE(tab_proxy->ExecuteJavaScript( | 69 ASSERT_TRUE(tab_proxy->ExecuteJavaScript( |
| 68 "window.before = window.chrome.loadTimes()")); | 70 "window.before = window.chrome.loadTimes()")); |
| 69 NavigateToURL(hash_url); | 71 NavigateToURL(hash_url); |
| 70 ASSERT_TRUE(tab_proxy->ExecuteJavaScript( | 72 ASSERT_TRUE(tab_proxy->ExecuteJavaScript( |
| 71 "window.after = window.chrome.loadTimes()")); | 73 "window.after = window.chrome.loadTimes()")); |
| 72 CompareBeforeAndAfter(tab_proxy.get()); | 74 CompareBeforeAndAfter(tab_proxy.get()); |
| 73 } | 75 } |
| OLD | NEW |