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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 GURL icon_url = embedded_test_server()->GetURL("/favicon/icon.png"); | 210 GURL icon_url = embedded_test_server()->GetURL("/favicon/icon.png"); |
211 | 211 |
212 std::unique_ptr<TestResourceDispatcherHostDelegate> delegate( | 212 std::unique_ptr<TestResourceDispatcherHostDelegate> delegate( |
213 new TestResourceDispatcherHostDelegate(icon_url)); | 213 new TestResourceDispatcherHostDelegate(icon_url)); |
214 content::ResourceDispatcherHost::Get()->SetDelegate(delegate.get()); | 214 content::ResourceDispatcherHost::Get()->SetDelegate(delegate.get()); |
215 | 215 |
216 // Initial visit in order to populate the cache. | 216 // Initial visit in order to populate the cache. |
217 { | 217 { |
218 PendingTaskWaiter waiter(web_contents(), this); | 218 PendingTaskWaiter waiter(web_contents(), this); |
219 ui_test_utils::NavigateToURLWithDisposition( | 219 ui_test_utils::NavigateToURLWithDisposition( |
220 browser(), url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); | 220 browser(), url, WindowOpenDisposition::CURRENT_TAB, |
| 221 ui_test_utils::BROWSER_TEST_NONE); |
221 waiter.Wait(); | 222 waiter.Wait(); |
222 } | 223 } |
223 ASSERT_TRUE(delegate->was_requested()); | 224 ASSERT_TRUE(delegate->was_requested()); |
224 EXPECT_FALSE(delegate->bypassed_cache()); | 225 EXPECT_FALSE(delegate->bypassed_cache()); |
225 delegate->Reset(); | 226 delegate->Reset(); |
226 | 227 |
227 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); | 228 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); |
228 | 229 |
229 // A normal visit should fetch the favicon from either the favicon database or | 230 // A normal visit should fetch the favicon from either the favicon database or |
230 // the HTTP cache. | 231 // the HTTP cache. |
231 { | 232 { |
232 PendingTaskWaiter waiter(web_contents(), this); | 233 PendingTaskWaiter waiter(web_contents(), this); |
233 ui_test_utils::NavigateToURLWithDisposition( | 234 ui_test_utils::NavigateToURLWithDisposition( |
234 browser(), url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); | 235 browser(), url, WindowOpenDisposition::CURRENT_TAB, |
| 236 ui_test_utils::BROWSER_TEST_NONE); |
235 waiter.Wait(); | 237 waiter.Wait(); |
236 } | 238 } |
237 EXPECT_FALSE(delegate->bypassed_cache()); | 239 EXPECT_FALSE(delegate->bypassed_cache()); |
238 delegate->Reset(); | 240 delegate->Reset(); |
239 | 241 |
240 // A reload ignoring the cache should refetch the favicon from the website. | 242 // A reload ignoring the cache should refetch the favicon from the website. |
241 { | 243 { |
242 PendingTaskWaiter waiter(web_contents(), this); | 244 PendingTaskWaiter waiter(web_contents(), this); |
243 chrome::ExecuteCommand(browser(), IDC_RELOAD_BYPASSING_CACHE); | 245 chrome::ExecuteCommand(browser(), IDC_RELOAD_BYPASSING_CACHE); |
244 waiter.Wait(); | 246 waiter.Wait(); |
245 } | 247 } |
246 ASSERT_TRUE(delegate->was_requested()); | 248 ASSERT_TRUE(delegate->was_requested()); |
247 EXPECT_TRUE(delegate->bypassed_cache()); | 249 EXPECT_TRUE(delegate->bypassed_cache()); |
248 } | 250 } |
OLD | NEW |