| 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 LoadTimingObserverUITest : public UITest { | 11 class LoadTimingObserverUITest : public UITest { |
| 12 public: | 12 public: |
| 13 LoadTimingObserverUITest() | 13 LoadTimingObserverUITest() |
| 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 protected: | 20 protected: |
| 19 net::TestServer http_server_; | 21 net::TestServer http_server_; |
| 20 }; | 22 }; |
| 21 | 23 |
| 22 // http://crbug.com/102030 | 24 // http://crbug.com/102030 |
| 23 // http://crbug.com/114390 | 25 // http://crbug.com/114390 |
| 24 TEST_F(LoadTimingObserverUITest, DISABLED_CacheHitAfterRedirect) { | 26 TEST_F(LoadTimingObserverUITest, DISABLED_CacheHitAfterRedirect) { |
| 25 ASSERT_TRUE(http_server_.Start()); | 27 ASSERT_TRUE(http_server_.Start()); |
| 26 GURL cached_page = http_server_.GetURL("cachetime"); | 28 GURL cached_page = http_server_.GetURL("cachetime"); |
| 27 std::string redirect = "server-redirect?" + cached_page.spec(); | 29 std::string redirect = "server-redirect?" + cached_page.spec(); |
| 28 NavigateToURL(cached_page); | 30 NavigateToURL(cached_page); |
| 29 NavigateToURL(http_server_.GetURL(redirect)); | 31 NavigateToURL(http_server_.GetURL(redirect)); |
| 30 scoped_refptr<TabProxy> tab_proxy = GetActiveTab(); | 32 scoped_refptr<TabProxy> tab_proxy = GetActiveTab(); |
| 31 int response_start = 0; | 33 int response_start = 0; |
| 32 int response_end = 0; | 34 int response_end = 0; |
| 33 ASSERT_TRUE(tab_proxy->ExecuteAndExtractInt( | 35 ASSERT_TRUE(tab_proxy->ExecuteAndExtractInt( |
| 34 L"", L"window.domAutomationController.send(" | 36 L"", L"window.domAutomationController.send(" |
| 35 L"window.performance.timing.responseStart - " | 37 L"window.performance.timing.responseStart - " |
| 36 L"window.performance.timing.navigationStart)", &response_start)); | 38 L"window.performance.timing.navigationStart)", &response_start)); |
| 37 ASSERT_TRUE(tab_proxy->ExecuteAndExtractInt( | 39 ASSERT_TRUE(tab_proxy->ExecuteAndExtractInt( |
| 38 L"", L"window.domAutomationController.send(" | 40 L"", L"window.domAutomationController.send(" |
| 39 L"window.performance.timing.responseEnd - " | 41 L"window.performance.timing.responseEnd - " |
| 40 L"window.performance.timing.navigationStart)", &response_end)); | 42 L"window.performance.timing.navigationStart)", &response_end)); |
| 41 EXPECT_LE(response_start, response_end); | 43 EXPECT_LE(response_start, response_end); |
| 42 } | 44 } |
| OLD | NEW |