| OLD | NEW |
| 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" | |
| 17 #include "chrome/browser/intents/default_web_intent_service.h" | 16 #include "chrome/browser/intents/default_web_intent_service.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/browser/ui/browser_tabstrip.h" | 19 #include "chrome/browser/ui/browser_tabstrip.h" |
| 21 #include "chrome/browser/ui/intents/web_intent_picker.h" | 20 #include "chrome/browser/ui/intents/web_intent_picker.h" |
| 22 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" | 21 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
| 23 #include "chrome/browser/ui/intents/web_intent_picker_model.h" | 22 #include "chrome/browser/ui/intents/web_intent_picker_model.h" |
| 24 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h" | 23 #include "chrome/browser/ui/intents/web_intent_picker_model_observer.h" |
| 25 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 24 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 26 #include "chrome/browser/webdata/web_data_service.h" | 25 #include "chrome/browser/webdata/web_data_service.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 virtual void SetUpOnMainThread() OVERRIDE { | 230 virtual void SetUpOnMainThread() OVERRIDE { |
| 232 // The FakeURLFetcherFactory will return a NULL URLFetcher if a request is | 231 // The FakeURLFetcherFactory will return a NULL URLFetcher if a request is |
| 233 // created for a URL it doesn't know and there is no default factory. | 232 // created for a URL it doesn't know and there is no default factory. |
| 234 // Instead, use this dummy factory to infinitely delay the request. | 233 // Instead, use this dummy factory to infinitely delay the request. |
| 235 default_url_fetcher_factory_.reset(new DummyURLFetcherFactory); | 234 default_url_fetcher_factory_.reset(new DummyURLFetcherFactory); |
| 236 fake_url_fetcher_factory_.reset( | 235 fake_url_fetcher_factory_.reset( |
| 237 new net::FakeURLFetcherFactory(default_url_fetcher_factory_.get())); | 236 new net::FakeURLFetcherFactory(default_url_fetcher_factory_.get())); |
| 238 | 237 |
| 239 web_data_service_ = WebDataServiceFactory::GetForProfile( | 238 web_data_service_ = WebDataServiceFactory::GetForProfile( |
| 240 GetBrowser()->profile(), Profile::EXPLICIT_ACCESS); | 239 GetBrowser()->profile(), Profile::EXPLICIT_ACCESS); |
| 241 favicon_service_ = FaviconServiceFactory::GetForProfile( | 240 favicon_service_ = |
| 242 GetBrowser()->profile(), Profile::EXPLICIT_ACCESS); | 241 GetBrowser()->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); |
| 243 controller_ = chrome::GetActiveTabContents(GetBrowser())-> | 242 controller_ = chrome::GetActiveTabContents(GetBrowser())-> |
| 244 web_intent_picker_controller(); | 243 web_intent_picker_controller(); |
| 245 | 244 |
| 246 SetupMockPicker(); | 245 SetupMockPicker(); |
| 247 controller_->set_model_observer(&picker_); | 246 controller_->set_model_observer(&picker_); |
| 248 picker_.delegate_ = controller_; | 247 picker_.delegate_ = controller_; |
| 249 | 248 |
| 250 CreateFakeIcon(); | 249 CreateFakeIcon(); |
| 251 } | 250 } |
| 252 | 251 |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 | 635 |
| 637 EXPECT_EQ(2, picker_.num_installed_services_); | 636 EXPECT_EQ(2, picker_.num_installed_services_); |
| 638 | 637 |
| 639 // The tab is shown immediately without needing to call OnServiceChosen. | 638 // The tab is shown immediately without needing to call OnServiceChosen. |
| 640 ASSERT_EQ(2, browser()->tab_count()); | 639 ASSERT_EQ(2, browser()->tab_count()); |
| 641 EXPECT_EQ(GURL(kServiceURL1), | 640 EXPECT_EQ(GURL(kServiceURL1), |
| 642 chrome::GetActiveWebContents(browser())->GetURL()); | 641 chrome::GetActiveWebContents(browser())->GetURL()); |
| 643 | 642 |
| 644 EXPECT_TRUE(dispatcher.dispatched_); | 643 EXPECT_TRUE(dispatcher.dispatched_); |
| 645 } | 644 } |
| OLD | NEW |