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

Unified Diff: chrome/browser/intents/web_intents_registry_unittest.cc

Issue 9799001: [Web Intents] Inline installation of extensions in web intents picker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: i'm dumb Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/intents/web_intents_registry_unittest.cc
diff --git a/chrome/browser/intents/web_intents_registry_unittest.cc b/chrome/browser/intents/web_intents_registry_unittest.cc
index ef1a1e1008edf08118ef52cafcbda5a357283b10..a88fe999d7fea28d2135e45d2c37d8294a51551d 100644
--- a/chrome/browser/intents/web_intents_registry_unittest.cc
+++ b/chrome/browser/intents/web_intents_registry_unittest.cc
@@ -25,6 +25,8 @@ class MockExtensionService: public TestExtensionService {
public:
virtual ~MockExtensionService() {}
MOCK_CONST_METHOD0(extensions, const ExtensionSet*());
+ MOCK_CONST_METHOD2(GetExtensionById,
+ const Extension*(const std::string&, bool));
};
namespace {
@@ -93,6 +95,9 @@ class WebIntentsRegistryTest : public testing::Test {
registry_.Initialize(wds_, &extension_service_);
EXPECT_CALL(extension_service_, extensions()).
WillRepeatedly(testing::Return(&extensions_));
+ EXPECT_CALL(extension_service_, GetExtensionById(testing::_, testing::_)).
+ WillRepeatedly(
+ testing::Invoke(this, &WebIntentsRegistryTest::GetExtensionById));
}
virtual void TearDown() {
@@ -104,6 +109,17 @@ class WebIntentsRegistryTest : public testing::Test {
MessageLoop::current()->Run();
}
+ const Extension* GetExtensionById(const std::string& extension_id,
+ testing::Unused) {
+ for (ExtensionSet::const_iterator iter = extensions_.begin();
+ iter != extensions_.end(); ++iter) {
+ if ((*iter)->id() == extension_id)
+ return &**iter;
+ }
+
+ return NULL;
+ }
+
MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
content::TestBrowserThread db_thread_;
@@ -194,6 +210,25 @@ TEST_F(WebIntentsRegistryTest, BasicTests) {
EXPECT_EQ(1U, consumer.services_.size());
}
+TEST_F(WebIntentsRegistryTest, GetIntentServicesForExtensionFilter) {
+ scoped_refptr<Extension> share_extension(
+ LoadAndExpectSuccess("intent_valid.json"));
+ scoped_refptr<Extension> edit_extension(
+ LoadAndExpectSuccess("intent_valid_2.json"));
+ extensions_.Insert(share_extension);
+ extensions_.Insert(edit_extension);
+ ASSERT_EQ(2U, extensions_.size());
+
+ TestConsumer consumer;
+ consumer.expected_id_ = registry_.GetIntentServicesForExtensionFilter(
+ ASCIIToUTF16("http://webintents.org/edit"),
+ ASCIIToUTF16("image/*"),
+ edit_extension->id(),
+ &consumer);
+ consumer.WaitForData();
+ ASSERT_EQ(1U, consumer.services_.size());
+}
+
TEST_F(WebIntentsRegistryTest, GetAllIntents) {
webkit_glue::WebIntentServiceData service;
service.service_url = GURL("http://google.com");
« no previous file with comments | « chrome/browser/intents/web_intents_registry.cc ('k') | chrome/browser/ui/cocoa/web_intent_sheet_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698