| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 633 |
| 634 TEST_F(WebDataServiceTest, WebIntents) { | 634 TEST_F(WebDataServiceTest, WebIntents) { |
| 635 WebIntentsConsumer consumer; | 635 WebIntentsConsumer consumer; |
| 636 | 636 |
| 637 wds_->GetWebIntents(ASCIIToUTF16("share"), &consumer); | 637 wds_->GetWebIntents(ASCIIToUTF16("share"), &consumer); |
| 638 WebIntentsConsumer::WaitUntilCalled(); | 638 WebIntentsConsumer::WaitUntilCalled(); |
| 639 EXPECT_EQ(0U, consumer.services_.size()); | 639 EXPECT_EQ(0U, consumer.services_.size()); |
| 640 | 640 |
| 641 WebIntentServiceData service; | 641 WebIntentServiceData service; |
| 642 service.service_url = GURL("http://google.com"); | 642 service.service_url = GURL("http://google.com"); |
| 643 service.action = ASCIIToUTF16("share1"); |
| 644 service.type = ASCIIToUTF16("image/*"); |
| 645 wds_->AddWebIntent(service); |
| 646 |
| 643 service.action = ASCIIToUTF16("share"); | 647 service.action = ASCIIToUTF16("share"); |
| 644 service.type = ASCIIToUTF16("image/*"); | 648 service.type = ASCIIToUTF16("image/*"); |
| 645 wds_->AddWebIntent(service); | 649 wds_->AddWebIntent(service); |
| 646 | 650 |
| 647 service.type = ASCIIToUTF16("video/*"); | 651 service.type = ASCIIToUTF16("video/*"); |
| 648 wds_->AddWebIntent(service); | 652 wds_->AddWebIntent(service); |
| 649 | 653 |
| 650 wds_->GetWebIntents(ASCIIToUTF16("share"), &consumer); | 654 wds_->GetWebIntents(ASCIIToUTF16("share"), &consumer); |
| 651 WebIntentsConsumer::WaitUntilCalled(); | 655 WebIntentsConsumer::WaitUntilCalled(); |
| 652 ASSERT_EQ(2U, consumer.services_.size()); | 656 ASSERT_EQ(2U, consumer.services_.size()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 667 wds_->GetWebIntents(ASCIIToUTF16("share"), &consumer); | 671 wds_->GetWebIntents(ASCIIToUTF16("share"), &consumer); |
| 668 WebIntentsConsumer::WaitUntilCalled(); | 672 WebIntentsConsumer::WaitUntilCalled(); |
| 669 ASSERT_EQ(1U, consumer.services_.size()); | 673 ASSERT_EQ(1U, consumer.services_.size()); |
| 670 | 674 |
| 671 service.type = ASCIIToUTF16("video/*"); | 675 service.type = ASCIIToUTF16("video/*"); |
| 672 EXPECT_EQ(service.service_url, consumer.services_[0].service_url); | 676 EXPECT_EQ(service.service_url, consumer.services_[0].service_url); |
| 673 EXPECT_EQ(service.action, consumer.services_[0].action); | 677 EXPECT_EQ(service.action, consumer.services_[0].action); |
| 674 EXPECT_EQ(service.type, consumer.services_[0].type); | 678 EXPECT_EQ(service.type, consumer.services_[0].type); |
| 675 } | 679 } |
| 676 | 680 |
| 681 TEST_F(WebDataServiceTest, WebIntentsForURL) { |
| 682 WebIntentsConsumer consumer; |
| 683 |
| 684 WebIntentServiceData service; |
| 685 service.service_url = GURL("http://google.com"); |
| 686 service.action = ASCIIToUTF16("share1"); |
| 687 service.type = ASCIIToUTF16("image/*"); |
| 688 wds_->AddWebIntent(service); |
| 689 |
| 690 service.action = ASCIIToUTF16("share"); |
| 691 service.type = ASCIIToUTF16("image/*"); |
| 692 wds_->AddWebIntent(service); |
| 693 |
| 694 wds_->GetWebIntentsForURL( |
| 695 UTF8ToUTF16(service.service_url.spec()), |
| 696 &consumer); |
| 697 WebIntentsConsumer::WaitUntilCalled(); |
| 698 ASSERT_EQ(2U, consumer.services_.size()); |
| 699 EXPECT_EQ(service, consumer.services_[0]); |
| 700 service.action = ASCIIToUTF16("share1"); |
| 701 EXPECT_EQ(service, consumer.services_[1]); |
| 702 } |
| 703 |
| 677 TEST_F(WebDataServiceTest, WebIntentsGetAll) { | 704 TEST_F(WebDataServiceTest, WebIntentsGetAll) { |
| 678 WebIntentsConsumer consumer; | 705 WebIntentsConsumer consumer; |
| 679 | 706 |
| 680 WebIntentServiceData service; | 707 WebIntentServiceData service; |
| 681 service.service_url = GURL("http://google.com"); | 708 service.service_url = GURL("http://google.com"); |
| 682 service.action = ASCIIToUTF16("share"); | 709 service.action = ASCIIToUTF16("share"); |
| 683 service.type = ASCIIToUTF16("image/*"); | 710 service.type = ASCIIToUTF16("image/*"); |
| 684 wds_->AddWebIntent(service); | 711 wds_->AddWebIntent(service); |
| 685 | 712 |
| 686 service.action = ASCIIToUTF16("edit"); | 713 service.action = ASCIIToUTF16("edit"); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 699 } | 726 } |
| 700 | 727 |
| 701 TEST_F(WebDataServiceTest, DidDefaultSearchProviderChangeOnNewProfile) { | 728 TEST_F(WebDataServiceTest, DidDefaultSearchProviderChangeOnNewProfile) { |
| 702 KeywordsConsumer consumer; | 729 KeywordsConsumer consumer; |
| 703 wds_->GetKeywords(&consumer); | 730 wds_->GetKeywords(&consumer); |
| 704 KeywordsConsumer::WaitUntilCalled(); | 731 KeywordsConsumer::WaitUntilCalled(); |
| 705 ASSERT_TRUE(consumer.load_succeeded); | 732 ASSERT_TRUE(consumer.load_succeeded); |
| 706 EXPECT_FALSE(consumer.keywords_result.did_default_search_provider_change); | 733 EXPECT_FALSE(consumer.keywords_result.did_default_search_provider_change); |
| 707 EXPECT_EQ(0, consumer.keywords_result.default_search_provider_id_backup); | 734 EXPECT_EQ(0, consumer.keywords_result.default_search_provider_id_backup); |
| 708 } | 735 } |
| OLD | NEW |