| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "chrome/test/ui/ui_test.h" | 8 #include "chrome/test/ui/ui_test.h" |
| 9 #include "chrome/test/automation/automation_proxy.h" | 9 #include "chrome/test/automation/automation_proxy.h" |
| 10 #include "chrome/test/automation/browser_proxy.h" | 10 #include "chrome/test/automation/browser_proxy.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Appends a new tab to the test chrome window and loads the specified | 47 // Appends a new tab to the test chrome window and loads the specified |
| 48 // URL. The new tab will try to get the URL from the cache before requesting | 48 // URL. The new tab will try to get the URL from the cache before requesting |
| 49 // the server for it. | 49 // the server for it. |
| 50 void GetNewTab(AutomationProxy* automationProxy, const GURL& tab_url); | 50 void GetNewTab(AutomationProxy* automationProxy, const GURL& tab_url); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 // Runs the cache test for the specified path. | 53 // Runs the cache test for the specified path. |
| 54 void CacheTest::RunCacheTest(const std::wstring &url, | 54 void CacheTest::RunCacheTest(const std::wstring &url, |
| 55 bool expect_new_tab_cached, | 55 bool expect_new_tab_cached, |
| 56 bool expect_delayed_reload) { | 56 bool expect_delayed_reload) { |
| 57 TestServer server(L"chrome/test/data"); | 57 scoped_refptr<HTTPTestServer> server = |
| 58 GURL test_page(server.TestServerPageW(url)); | 58 HTTPTestServer::CreateServer(L"chrome/test/data"); |
| 59 ASSERT_TRUE(NULL != server.get()); |
| 60 GURL test_page(server->TestServerPageW(url)); |
| 59 | 61 |
| 60 NavigateToURL(test_page); | 62 NavigateToURL(test_page); |
| 61 std::wstring original_time = GetActiveTabTitle(); | 63 std::wstring original_time = GetActiveTabTitle(); |
| 62 | 64 |
| 63 Sleep(kWaitForCacheUpdateMsec); | 65 Sleep(kWaitForCacheUpdateMsec); |
| 64 | 66 |
| 65 GetNewTab(automation(), test_page); | 67 GetNewTab(automation(), test_page); |
| 66 std::wstring revisit_time = GetActiveTabTitle(); | 68 std::wstring revisit_time = GetActiveTabTitle(); |
| 67 | 69 |
| 68 if (expect_new_tab_cached) { | 70 if (expect_new_tab_cached) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 TEST_F(CacheTest, NoStoreMaxAge) { | 170 TEST_F(CacheTest, NoStoreMaxAge) { |
| 169 RunCacheTest(L"cache/no-store/max-age", false, false); | 171 RunCacheTest(L"cache/no-store/max-age", false, false); |
| 170 } | 172 } |
| 171 | 173 |
| 172 // Tests that a cached copy of the page is not transformed when no-transform | 174 // Tests that a cached copy of the page is not transformed when no-transform |
| 173 // header is specified. | 175 // header is specified. |
| 174 TEST_F(CacheTest, NoTransform) { | 176 TEST_F(CacheTest, NoTransform) { |
| 175 RunCacheTest(L"cache/no-transform", false, false); | 177 RunCacheTest(L"cache/no-transform", false, false); |
| 176 } | 178 } |
| 177 | 179 |
| OLD | NEW |