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

Side by Side Diff: chrome/browser/intents/web_intents_registry_unittest.cc

Issue 10854019: Make GetIntentServicesForExtensionFilter work synchronously (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make GetIntentServicesForExtensionFilter synchronous. 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/json/json_file_value_serializer.h" 7 #include "base/json/json_file_value_serializer.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 TEST_F(WebIntentsRegistryTest, GetIntentServicesForExtensionFilter) { 252 TEST_F(WebIntentsRegistryTest, GetIntentServicesForExtensionFilter) {
253 scoped_refptr<Extension> share_extension( 253 scoped_refptr<Extension> share_extension(
254 LoadAndExpectSuccess("intent_valid.json")); 254 LoadAndExpectSuccess("intent_valid.json"));
255 scoped_refptr<Extension> edit_extension( 255 scoped_refptr<Extension> edit_extension(
256 LoadAndExpectSuccess("intent_valid_2.json")); 256 LoadAndExpectSuccess("intent_valid_2.json"));
257 extensions_.Insert(share_extension); 257 extensions_.Insert(share_extension);
258 extensions_.Insert(edit_extension); 258 extensions_.Insert(edit_extension);
259 ASSERT_EQ(2U, extensions_.size()); 259 ASSERT_EQ(2U, extensions_.size());
260 260
261 ServiceListConsumer consumer; 261 WebIntentsRegistry::IntentServiceList services;
262 registry_.GetIntentServicesForExtensionFilter( 262 registry_.GetIntentServicesForExtensionFilter(
263 ASCIIToUTF16("http://webintents.org/edit"), 263 ASCIIToUTF16("http://webintents.org/edit"),
264 ASCIIToUTF16("image/*"), 264 ASCIIToUTF16("image/*"),
265 edit_extension->id(), 265 edit_extension->id(),
266 base::Bind(&ServiceListConsumer::Accept, 266 &services);
267 base::Unretained(&consumer))); 267 ASSERT_EQ(1U, services.size());
268 consumer.WaitForData();
269 ASSERT_EQ(1U, consumer.services_.size());
270 268
271 EXPECT_EQ(edit_extension->url().spec() + "services/edit", 269 EXPECT_EQ(edit_extension->url().spec() + "services/edit",
272 consumer.services_[0].service_url.spec()); 270 services[0].service_url.spec());
273 } 271 }
274 272
275 TEST_F(WebIntentsRegistryTest, GetAllIntents) { 273 TEST_F(WebIntentsRegistryTest, GetAllIntents) {
276 webkit_glue::WebIntentServiceData service; 274 webkit_glue::WebIntentServiceData service;
277 service.service_url = GURL("http://google.com"); 275 service.service_url = GURL("http://google.com");
278 service.action = ASCIIToUTF16("share"); 276 service.action = ASCIIToUTF16("share");
279 service.type = ASCIIToUTF16("image/*"); 277 service.type = ASCIIToUTF16("image/*");
280 service.title = ASCIIToUTF16("Google's Sharing Service"); 278 service.title = ASCIIToUTF16("Google's Sharing Service");
281 registry_.RegisterIntentService(service); 279 registry_.RegisterIntentService(service);
282 280
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 ServiceListConsumer consumer; 725 ServiceListConsumer consumer;
728 registry_.GetIntentServices(ASCIIToUTF16("http://webintents.org/share"), 726 registry_.GetIntentServices(ASCIIToUTF16("http://webintents.org/share"),
729 ASCIIToUTF16("image/*"), 727 ASCIIToUTF16("image/*"),
730 base::Bind(&ServiceListConsumer::Accept, 728 base::Bind(&ServiceListConsumer::Accept,
731 base::Unretained(&consumer))); 729 base::Unretained(&consumer)));
732 730
733 consumer.WaitForData(); 731 consumer.WaitForData();
734 ASSERT_EQ(1U, consumer.services_.size()); 732 ASSERT_EQ(1U, consumer.services_.size());
735 EXPECT_EQ(ASCIIToUTF16("image/png,image/jpg"), consumer.services_[0].type); 733 EXPECT_EQ(ASCIIToUTF16("image/png,image/jpg"), consumer.services_[0].type);
736 } 734 }
OLDNEW
« no previous file with comments | « chrome/browser/intents/web_intents_registry.cc ('k') | chrome/browser/ui/intents/web_intent_picker_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698