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

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

Issue 10959045: Switch WebIntentPickerController to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // created for a URL it doesn't know and there is no default factory. 234 // created for a URL it doesn't know and there is no default factory.
235 // Instead, use this dummy factory to infinitely delay the request. 235 // Instead, use this dummy factory to infinitely delay the request.
236 default_url_fetcher_factory_.reset(new DummyURLFetcherFactory); 236 default_url_fetcher_factory_.reset(new DummyURLFetcherFactory);
237 fake_url_fetcher_factory_.reset( 237 fake_url_fetcher_factory_.reset(
238 new net::FakeURLFetcherFactory(default_url_fetcher_factory_.get())); 238 new net::FakeURLFetcherFactory(default_url_fetcher_factory_.get()));
239 239
240 web_data_service_ = WebDataServiceFactory::GetForProfile( 240 web_data_service_ = WebDataServiceFactory::GetForProfile(
241 GetBrowser()->profile(), Profile::EXPLICIT_ACCESS); 241 GetBrowser()->profile(), Profile::EXPLICIT_ACCESS);
242 favicon_service_ = FaviconServiceFactory::GetForProfile( 242 favicon_service_ = FaviconServiceFactory::GetForProfile(
243 GetBrowser()->profile(), Profile::EXPLICIT_ACCESS); 243 GetBrowser()->profile(), Profile::EXPLICIT_ACCESS);
244 controller_ = chrome::GetActiveTabContents(GetBrowser())-> 244 controller_ = WebIntentPickerController::FromWebContents(
245 web_intent_picker_controller(); 245 chrome::GetActiveWebContents(GetBrowser()));
246 246
247 SetupMockPicker(); 247 SetupMockPicker();
248 controller_->set_model_observer(&picker_); 248 controller_->set_model_observer(&picker_);
249 picker_.delegate_ = controller_; 249 picker_.delegate_ = controller_;
250 250
251 CreateFakeIcon(); 251 CreateFakeIcon();
252 } 252 }
253 253
254 virtual void SetupMockPicker() { 254 virtual void SetupMockPicker() {
255 controller_->set_picker(&picker_); 255 controller_->set_picker(&picker_);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 EXPECT_EQ(2, picker_.num_installed_services_); 362 EXPECT_EQ(2, picker_.num_installed_services_);
363 EXPECT_EQ(0, picker_.num_icons_changed_); 363 EXPECT_EQ(0, picker_.num_icons_changed_);
364 364
365 OnServiceChosen(kServiceURL2, 365 OnServiceChosen(kServiceURL2,
366 webkit_glue::WebIntentServiceData::DISPOSITION_WINDOW); 366 webkit_glue::WebIntentServiceData::DISPOSITION_WINDOW);
367 ASSERT_EQ(2, browser()->tab_count()); 367 ASSERT_EQ(2, browser()->tab_count());
368 EXPECT_EQ(GURL(kServiceURL2), 368 EXPECT_EQ(GURL(kServiceURL2),
369 chrome::GetActiveWebContents(browser())->GetURL()); 369 chrome::GetActiveWebContents(browser())->GetURL());
370 370
371 EXPECT_TRUE(GetWindowDispositionTarget( 371 EXPECT_TRUE(GetWindowDispositionTarget(
372 chrome::GetActiveTabContents(browser())->web_intent_picker_controller())); 372 WebIntentPickerController::FromWebContents(
373 chrome::GetActiveWebContents(browser()))));
373 374
374 EXPECT_TRUE(dispatcher.dispatched_); 375 EXPECT_TRUE(dispatcher.dispatched_);
375 376
376 OnSendReturnMessage(webkit_glue::WEB_INTENT_REPLY_SUCCESS); 377 OnSendReturnMessage(webkit_glue::WEB_INTENT_REPLY_SUCCESS);
377 ASSERT_EQ(1, browser()->tab_count()); 378 ASSERT_EQ(1, browser()->tab_count());
378 } 379 }
379 380
380 IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest, 381 IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest,
381 FetchExtensionIcon) { 382 FetchExtensionIcon) {
382 AddWebIntentService(kAction1, kServiceURL1); 383 AddWebIntentService(kAction1, kServiceURL1);
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 controller_->ShowDialog(kAction1, kType1); 698 controller_->ShowDialog(kAction1, kType1);
698 picker_.Wait(); 699 picker_.Wait();
699 700
700 EXPECT_EQ(2, picker_.num_installed_services_); 701 EXPECT_EQ(2, picker_.num_installed_services_);
701 702
702 // The found default isn't used immediately because the defaulting 703 // The found default isn't used immediately because the defaulting
703 // context has changed. 704 // context has changed.
704 ASSERT_EQ(1, browser()->tab_count()); 705 ASSERT_EQ(1, browser()->tab_count());
705 EXPECT_FALSE(dispatcher.dispatched_); 706 EXPECT_FALSE(dispatcher.dispatched_);
706 } 707 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698