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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 "http://www.example.com:%d/files/extensions/intents/%%s.crx", | 215 "http://www.example.com:%d/files/extensions/intents/%%s.crx", |
216 host_port.port())); | 216 host_port.port())); |
217 command_line->AppendSwitchASCII( | 217 command_line->AppendSwitchASCII( |
218 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); | 218 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); |
219 } | 219 } |
220 | 220 |
221 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 221 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
222 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 222 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
223 } | 223 } |
224 | 224 |
225 content::WebContents* GetWindowDispositionTarget( | |
226 WebIntentPickerController* controller) { | |
227 return controller->window_disposition_source_; | |
228 } | |
229 | |
225 virtual void SetUpOnMainThread() OVERRIDE { | 230 virtual void SetUpOnMainThread() OVERRIDE { |
226 // The FakeURLFetcherFactory will return a NULL URLFetcher if a request is | 231 // The FakeURLFetcherFactory will return a NULL URLFetcher if a request is |
227 // 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. |
228 // Instead, use this dummy factory to infinitely delay the request. | 233 // Instead, use this dummy factory to infinitely delay the request. |
229 default_url_fetcher_factory_.reset(new DummyURLFetcherFactory); | 234 default_url_fetcher_factory_.reset(new DummyURLFetcherFactory); |
230 fake_url_fetcher_factory_.reset( | 235 fake_url_fetcher_factory_.reset( |
231 new net::FakeURLFetcherFactory(default_url_fetcher_factory_.get())); | 236 new net::FakeURLFetcherFactory(default_url_fetcher_factory_.get())); |
232 | 237 |
233 web_data_service_ = WebDataServiceFactory::GetForProfile( | 238 web_data_service_ = WebDataServiceFactory::GetForProfile( |
234 GetBrowser()->profile(), Profile::EXPLICIT_ACCESS); | 239 GetBrowser()->profile(), Profile::EXPLICIT_ACCESS); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 intent.action = ASCIIToUTF16("a"); | 350 intent.action = ASCIIToUTF16("a"); |
346 intent.type = ASCIIToUTF16("b"); | 351 intent.type = ASCIIToUTF16("b"); |
347 IntentsDispatcherMock dispatcher(intent); | 352 IntentsDispatcherMock dispatcher(intent); |
348 controller_->SetIntentsDispatcher(&dispatcher); | 353 controller_->SetIntentsDispatcher(&dispatcher); |
349 | 354 |
350 OnServiceChosen(kServiceURL2, WebIntentPickerModel::DISPOSITION_WINDOW); | 355 OnServiceChosen(kServiceURL2, WebIntentPickerModel::DISPOSITION_WINDOW); |
351 ASSERT_EQ(2, browser()->tab_count()); | 356 ASSERT_EQ(2, browser()->tab_count()); |
352 EXPECT_EQ(GURL(kServiceURL2), | 357 EXPECT_EQ(GURL(kServiceURL2), |
353 chrome::GetActiveWebContents(browser())->GetURL()); | 358 chrome::GetActiveWebContents(browser())->GetURL()); |
354 | 359 |
360 EXPECT_TRUE(NULL != GetWindowDispositionTarget( | |
groby-ooo-7-16
2012/07/30 20:10:05
nit: Without the NULL!=?
Greg Billock
2012/07/30 20:23:57
Done.
| |
361 chrome::GetActiveTabContents(browser())->web_intent_picker_controller())); | |
362 | |
355 EXPECT_TRUE(dispatcher.dispatched_); | 363 EXPECT_TRUE(dispatcher.dispatched_); |
356 | 364 |
357 OnSendReturnMessage(webkit_glue::WEB_INTENT_REPLY_SUCCESS); | 365 OnSendReturnMessage(webkit_glue::WEB_INTENT_REPLY_SUCCESS); |
358 ASSERT_EQ(1, browser()->tab_count()); | 366 ASSERT_EQ(1, browser()->tab_count()); |
359 } | 367 } |
360 | 368 |
361 IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest, | 369 IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest, |
362 FetchExtensionIcon) { | 370 FetchExtensionIcon) { |
363 AddWebIntentService(kAction1, kServiceURL1); | 371 AddWebIntentService(kAction1, kServiceURL1); |
364 AddWebIntentService(kAction1, kServiceURL2); | 372 AddWebIntentService(kAction1, kServiceURL2); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
623 | 631 |
624 EXPECT_EQ(2, picker_.num_installed_services_); | 632 EXPECT_EQ(2, picker_.num_installed_services_); |
625 | 633 |
626 // The tab is shown immediately without needing to call OnServiceChosen. | 634 // The tab is shown immediately without needing to call OnServiceChosen. |
627 ASSERT_EQ(2, browser()->tab_count()); | 635 ASSERT_EQ(2, browser()->tab_count()); |
628 EXPECT_EQ(GURL(kServiceURL1), | 636 EXPECT_EQ(GURL(kServiceURL1), |
629 chrome::GetActiveWebContents(browser())->GetURL()); | 637 chrome::GetActiveWebContents(browser())->GetURL()); |
630 | 638 |
631 EXPECT_TRUE(dispatcher.dispatched_); | 639 EXPECT_TRUE(dispatcher.dispatched_); |
632 } | 640 } |
OLD | NEW |