| 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..82077fddde817347dc6e226489ab14178bd491e2 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,21 @@ TEST_F(WebIntentsRegistryTest, BasicTests) {
|
| EXPECT_EQ(1U, consumer.services_.size());
|
| }
|
|
|
| +TEST_F(WebIntentsRegistryTest, GetIntentServicesForExtensionFilter) {
|
| + extensions_.Insert(LoadAndExpectSuccess("intent_valid.json"));
|
| + extensions_.Insert(LoadAndExpectSuccess("intent_valid_2.json"));
|
| + ASSERT_EQ(2U, extensions_.size());
|
| +
|
| + TestConsumer consumer;
|
| + consumer.expected_id_ = registry_.GetIntentServicesForExtensionFilter(
|
| + ASCIIToUTF16("http://webintents.org/edit"),
|
| + ASCIIToUTF16("image/*"),
|
| + (*extensions_.begin())->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");
|
|
|