Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: chrome/browser/favicon/favicon_tab_helper_browsertest.cc

Issue 1064823002: Componentize FaviconTabHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@favicon-notification
Patch Set: Fix BUILD.gn Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/favicon/favicon_tab_helper.h" 5 #include "chrome/browser/favicon/favicon_tab_helper.h"
6 6
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/scoped_observer.h" 9 #include "base/scoped_observer.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 public: 180 public:
181 FaviconTabHelperTest() {} 181 FaviconTabHelperTest() {}
182 ~FaviconTabHelperTest() override {} 182 ~FaviconTabHelperTest() override {}
183 183
184 content::WebContents* web_contents() { 184 content::WebContents* web_contents() {
185 return browser()->tab_strip_model()->GetActiveWebContents(); 185 return browser()->tab_strip_model()->GetActiveWebContents();
186 } 186 }
187 187
188 // FaviconTabHelperPendingTaskChecker: 188 // FaviconTabHelperPendingTaskChecker:
189 bool HasPendingTasks() override { 189 bool HasPendingTasks() override {
190 favicon::FaviconHandler* favicon_handler = 190 return FaviconTabHelper::FromWebContents(web_contents())
191 FaviconTabHelper::FromWebContents(web_contents()) 191 ->HasPendingTasksForTest();
192 ->favicon_handler_.get();
193 return !favicon_handler->download_requests_.empty() ||
194 favicon_handler->cancelable_task_tracker_.HasTrackedTasks();
195 } 192 }
196 193
197 private: 194 private:
198 DISALLOW_COPY_AND_ASSIGN(FaviconTabHelperTest); 195 DISALLOW_COPY_AND_ASSIGN(FaviconTabHelperTest);
199 }; 196 };
200 197
201 // Test that when a user reloads a page ignoring the cache that the favicon is 198 // Test that when a user reloads a page ignoring the cache that the favicon is
202 // is redownloaded and (not returned from either the favicon cache or the HTTP 199 // is redownloaded and (not returned from either the favicon cache or the HTTP
203 // cache). 200 // cache).
204 IN_PROC_BROWSER_TEST_F(FaviconTabHelperTest, ReloadIgnoringCache) { 201 IN_PROC_BROWSER_TEST_F(FaviconTabHelperTest, ReloadIgnoringCache) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 233
237 // A reload ignoring the cache should refetch the favicon from the website. 234 // A reload ignoring the cache should refetch the favicon from the website.
238 { 235 {
239 PendingTaskWaiter waiter(web_contents(), this); 236 PendingTaskWaiter waiter(web_contents(), this);
240 chrome::ExecuteCommand(browser(), IDC_RELOAD_IGNORING_CACHE); 237 chrome::ExecuteCommand(browser(), IDC_RELOAD_IGNORING_CACHE);
241 waiter.Wait(); 238 waiter.Wait();
242 } 239 }
243 ASSERT_TRUE(delegate->was_requested()); 240 ASSERT_TRUE(delegate->was_requested());
244 EXPECT_TRUE(delegate->bypassed_cache()); 241 EXPECT_TRUE(delegate->bypassed_cache());
245 } 242 }
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_tab_helper.cc ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698