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

Side by Side Diff: chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc

Issue 10828263: Moving FaviconService to a ProfileKeyedService. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: resyncing with library after revert Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <iterator> 6 #include <iterator>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/favicon/favicon_service.h" 15 #include "chrome/browser/favicon/favicon_service.h"
16 #include "chrome/browser/favicon/favicon_service_factory.h"
16 #include "chrome/browser/intents/default_web_intent_service.h" 17 #include "chrome/browser/intents/default_web_intent_service.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_tabstrip.h" 20 #include "chrome/browser/ui/browser_tabstrip.h"
20 #include "chrome/browser/ui/intents/web_intent_picker.h" 21 #include "chrome/browser/ui/intents/web_intent_picker.h"
21 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" 22 #include "chrome/browser/ui/intents/web_intent_picker_controller.h"
22 #include "chrome/browser/ui/intents/web_intent_picker_model.h" 23 #include "chrome/browser/ui/intents/web_intent_picker_model.h"
23 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h" 24 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h"
24 #include "chrome/browser/ui/tab_contents/tab_contents.h" 25 #include "chrome/browser/ui/tab_contents/tab_contents.h"
25 #include "chrome/browser/webdata/web_data_service.h" 26 #include "chrome/browser/webdata/web_data_service.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 virtual void SetUpOnMainThread() OVERRIDE { 231 virtual void SetUpOnMainThread() OVERRIDE {
231 // The FakeURLFetcherFactory will return a NULL URLFetcher if a request is 232 // The FakeURLFetcherFactory will return a NULL URLFetcher if a request is
232 // created for a URL it doesn't know and there is no default factory. 233 // created for a URL it doesn't know and there is no default factory.
233 // Instead, use this dummy factory to infinitely delay the request. 234 // Instead, use this dummy factory to infinitely delay the request.
234 default_url_fetcher_factory_.reset(new DummyURLFetcherFactory); 235 default_url_fetcher_factory_.reset(new DummyURLFetcherFactory);
235 fake_url_fetcher_factory_.reset( 236 fake_url_fetcher_factory_.reset(
236 new net::FakeURLFetcherFactory(default_url_fetcher_factory_.get())); 237 new net::FakeURLFetcherFactory(default_url_fetcher_factory_.get()));
237 238
238 web_data_service_ = WebDataServiceFactory::GetForProfile( 239 web_data_service_ = WebDataServiceFactory::GetForProfile(
239 GetBrowser()->profile(), Profile::EXPLICIT_ACCESS); 240 GetBrowser()->profile(), Profile::EXPLICIT_ACCESS);
240 favicon_service_ = 241 favicon_service_ = FaviconServiceFactory::GetForProfile(
241 GetBrowser()->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); 242 GetBrowser()->profile(), Profile::EXPLICIT_ACCESS);
242 controller_ = chrome::GetActiveTabContents(GetBrowser())-> 243 controller_ = chrome::GetActiveTabContents(GetBrowser())->
243 web_intent_picker_controller(); 244 web_intent_picker_controller();
244 245
245 SetupMockPicker(); 246 SetupMockPicker();
246 controller_->set_model_observer(&picker_); 247 controller_->set_model_observer(&picker_);
247 picker_.delegate_ = controller_; 248 picker_.delegate_ = controller_;
248 249
249 CreateFakeIcon(); 250 CreateFakeIcon();
250 } 251 }
251 252
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 636
636 EXPECT_EQ(2, picker_.num_installed_services_); 637 EXPECT_EQ(2, picker_.num_installed_services_);
637 638
638 // The tab is shown immediately without needing to call OnServiceChosen. 639 // The tab is shown immediately without needing to call OnServiceChosen.
639 ASSERT_EQ(2, browser()->tab_count()); 640 ASSERT_EQ(2, browser()->tab_count());
640 EXPECT_EQ(GURL(kServiceURL1), 641 EXPECT_EQ(GURL(kServiceURL1),
641 chrome::GetActiveWebContents(browser())->GetURL()); 642 chrome::GetActiveWebContents(browser())->GetURL());
642 643
643 EXPECT_TRUE(dispatcher.dispatched_); 644 EXPECT_TRUE(dispatcher.dispatched_);
644 } 645 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698