Chromium Code Reviews| 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 "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" |
| 11 #include "base/stringprintf.h" | |
|
Aaron Boodman
2012/05/10 16:49:08
Doesn't look like either of these include addition
Greg Billock
2012/05/14 16:09:55
Done.
| |
| 11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/extensions/test_extension_service.h" | 13 #include "chrome/browser/extensions/test_extension_service.h" |
| 13 #include "chrome/browser/intents/default_web_intent_service.h" | 14 #include "chrome/browser/intents/default_web_intent_service.h" |
| 14 #include "chrome/browser/intents/web_intents_registry.h" | 15 #include "chrome/browser/intents/web_intents_registry.h" |
| 15 #include "chrome/browser/webdata/web_data_service.h" | 16 #include "chrome/browser/webdata/web_data_service.h" |
| 16 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 18 #include "chrome/common/url_constants.h" | |
| 17 #include "chrome/common/extensions/extension_set.h" | 19 #include "chrome/common/extensions/extension_set.h" |
| 18 #include "content/test/test_browser_thread.h" | 20 #include "content/test/test_browser_thread.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 23 |
| 22 using content::BrowserThread; | 24 using content::BrowserThread; |
| 23 using webkit_glue::WebIntentServiceData; | 25 using webkit_glue::WebIntentServiceData; |
| 24 | 26 |
| 25 class MockExtensionService: public TestExtensionService { | 27 class MockExtensionService: public TestExtensionService { |
| 26 public: | 28 public: |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 | 226 |
| 225 TestConsumer consumer; | 227 TestConsumer consumer; |
| 226 registry_.GetIntentServicesForExtensionFilter( | 228 registry_.GetIntentServicesForExtensionFilter( |
| 227 ASCIIToUTF16("http://webintents.org/edit"), | 229 ASCIIToUTF16("http://webintents.org/edit"), |
| 228 ASCIIToUTF16("image/*"), | 230 ASCIIToUTF16("image/*"), |
| 229 edit_extension->id(), | 231 edit_extension->id(), |
| 230 base::Bind(&TestConsumer::OnIntentsQueryDone, | 232 base::Bind(&TestConsumer::OnIntentsQueryDone, |
| 231 base::Unretained(&consumer))); | 233 base::Unretained(&consumer))); |
| 232 consumer.WaitForData(); | 234 consumer.WaitForData(); |
| 233 ASSERT_EQ(1U, consumer.services_.size()); | 235 ASSERT_EQ(1U, consumer.services_.size()); |
| 236 | |
| 237 EXPECT_EQ(edit_extension->url().spec() + "services/edit", | |
| 238 consumer.services_[0].service_url.spec()); | |
| 234 } | 239 } |
| 235 | 240 |
| 236 TEST_F(WebIntentsRegistryTest, GetAllIntents) { | 241 TEST_F(WebIntentsRegistryTest, GetAllIntents) { |
| 237 webkit_glue::WebIntentServiceData service; | 242 webkit_glue::WebIntentServiceData service; |
| 238 service.service_url = GURL("http://google.com"); | 243 service.service_url = GURL("http://google.com"); |
| 239 service.action = ASCIIToUTF16("share"); | 244 service.action = ASCIIToUTF16("share"); |
| 240 service.type = ASCIIToUTF16("image/*"); | 245 service.type = ASCIIToUTF16("image/*"); |
| 241 service.title = ASCIIToUTF16("Google's Sharing Service"); | 246 service.title = ASCIIToUTF16("Google's Sharing Service"); |
| 242 registry_.RegisterIntentService(service); | 247 registry_.RegisterIntentService(service); |
| 243 | 248 |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 TestConsumer consumer; | 629 TestConsumer consumer; |
| 625 registry_.GetIntentServices(ASCIIToUTF16("http://webintents.org/share"), | 630 registry_.GetIntentServices(ASCIIToUTF16("http://webintents.org/share"), |
| 626 ASCIIToUTF16("image/*"), | 631 ASCIIToUTF16("image/*"), |
| 627 base::Bind(&TestConsumer::OnIntentsQueryDone, | 632 base::Bind(&TestConsumer::OnIntentsQueryDone, |
| 628 base::Unretained(&consumer))); | 633 base::Unretained(&consumer))); |
| 629 | 634 |
| 630 consumer.WaitForData(); | 635 consumer.WaitForData(); |
| 631 ASSERT_EQ(1U, consumer.services_.size()); | 636 ASSERT_EQ(1U, consumer.services_.size()); |
| 632 EXPECT_EQ(ASCIIToUTF16("image/png,image/jpg"), consumer.services_[0].type); | 637 EXPECT_EQ(ASCIIToUTF16("image/png,image/jpg"), consumer.services_[0].type); |
| 633 } | 638 } |
| OLD | NEW |