| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/favicon/content/content_favicon_driver.h" | 5 #include "components/favicon/content/content_favicon_driver.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 ->HasPendingTasksForTest(); | 198 ->HasPendingTasksForTest(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 private: | 201 private: |
| 202 DISALLOW_COPY_AND_ASSIGN(ContentFaviconDriverTest); | 202 DISALLOW_COPY_AND_ASSIGN(ContentFaviconDriverTest); |
| 203 }; | 203 }; |
| 204 | 204 |
| 205 // Test that when a user reloads a page ignoring the cache that the favicon is | 205 // Test that when a user reloads a page ignoring the cache that the favicon is |
| 206 // is redownloaded and (not returned from either the favicon cache or the HTTP | 206 // is redownloaded and (not returned from either the favicon cache or the HTTP |
| 207 // cache). | 207 // cache). |
| 208 IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest, ReloadIgnoringCache) { | 208 IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest, ReloadBypassingCache) { |
| 209 ASSERT_TRUE(embedded_test_server()->Start()); | 209 ASSERT_TRUE(embedded_test_server()->Start()); |
| 210 GURL url = embedded_test_server()->GetURL("/favicon/page_with_favicon.html"); | 210 GURL url = embedded_test_server()->GetURL("/favicon/page_with_favicon.html"); |
| 211 GURL icon_url = embedded_test_server()->GetURL("/favicon/icon.png"); | 211 GURL icon_url = embedded_test_server()->GetURL("/favicon/icon.png"); |
| 212 | 212 |
| 213 scoped_ptr<TestResourceDispatcherHostDelegate> delegate( | 213 scoped_ptr<TestResourceDispatcherHostDelegate> delegate( |
| 214 new TestResourceDispatcherHostDelegate(icon_url)); | 214 new TestResourceDispatcherHostDelegate(icon_url)); |
| 215 content::ResourceDispatcherHost::Get()->SetDelegate(delegate.get()); | 215 content::ResourceDispatcherHost::Get()->SetDelegate(delegate.get()); |
| 216 | 216 |
| 217 // Initial visit in order to populate the cache. | 217 // Initial visit in order to populate the cache. |
| 218 { | 218 { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 234 ui_test_utils::NavigateToURLWithDisposition( | 234 ui_test_utils::NavigateToURLWithDisposition( |
| 235 browser(), url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); | 235 browser(), url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); |
| 236 waiter.Wait(); | 236 waiter.Wait(); |
| 237 } | 237 } |
| 238 EXPECT_FALSE(delegate->bypassed_cache()); | 238 EXPECT_FALSE(delegate->bypassed_cache()); |
| 239 delegate->Reset(); | 239 delegate->Reset(); |
| 240 | 240 |
| 241 // A reload ignoring the cache should refetch the favicon from the website. | 241 // A reload ignoring the cache should refetch the favicon from the website. |
| 242 { | 242 { |
| 243 PendingTaskWaiter waiter(web_contents(), this); | 243 PendingTaskWaiter waiter(web_contents(), this); |
| 244 chrome::ExecuteCommand(browser(), IDC_RELOAD_IGNORING_CACHE); | 244 chrome::ExecuteCommand(browser(), IDC_RELOAD_BYPASSING_CACHE); |
| 245 waiter.Wait(); | 245 waiter.Wait(); |
| 246 } | 246 } |
| 247 ASSERT_TRUE(delegate->was_requested()); | 247 ASSERT_TRUE(delegate->was_requested()); |
| 248 EXPECT_TRUE(delegate->bypassed_cache()); | 248 EXPECT_TRUE(delegate->bypassed_cache()); |
| 249 } | 249 } |
| OLD | NEW |