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

Side by Side Diff: chrome/browser/webdata/web_data_service_unittest.cc

Issue 8144013: Add a check to the registry before the intent infobar is shown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More updates Created 9 years, 1 month 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) 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 wds_->GetWebIntents(ASCIIToUTF16("share"), &consumer); 632 wds_->GetWebIntents(ASCIIToUTF16("share"), &consumer);
633 WebIntentsConsumer::WaitUntilCalled(); 633 WebIntentsConsumer::WaitUntilCalled();
634 ASSERT_EQ(1U, consumer.intents.size()); 634 ASSERT_EQ(1U, consumer.intents.size());
635 635
636 service.type = ASCIIToUTF16("video/*"); 636 service.type = ASCIIToUTF16("video/*");
637 EXPECT_EQ(service.service_url, consumer.intents[0].service_url); 637 EXPECT_EQ(service.service_url, consumer.intents[0].service_url);
638 EXPECT_EQ(service.action, consumer.intents[0].action); 638 EXPECT_EQ(service.action, consumer.intents[0].action);
639 EXPECT_EQ(service.type, consumer.intents[0].type); 639 EXPECT_EQ(service.type, consumer.intents[0].type);
640 } 640 }
641 641
642 TEST_F(WebDataServiceTest, WebIntentsForURL) {
643 WebIntentsConsumer consumer;
644
645 WebIntentServiceData service;
646 service.service_url = GURL("http://google.com");
647 service.action = ASCIIToUTF16("share1");
648 service.type = ASCIIToUTF16("image/*");
649 wds_->AddWebIntent(service);
650
651 service.action = ASCIIToUTF16("share");
652 service.type = ASCIIToUTF16("image/*");
653 wds_->AddWebIntent(service);
654
655 wds_->GetWebIntentsForURL(
656 UTF8ToUTF16(service.service_url.spec()),
657 &consumer);
658 WebIntentsConsumer::WaitUntilCalled();
659 ASSERT_EQ(2U, consumer.intents.size());
660 EXPECT_EQ(service, consumer.intents[0]);
661 service.action = ASCIIToUTF16("share1");
662 EXPECT_EQ(service, consumer.intents[1]);
663 }
664
642 TEST_F(WebDataServiceTest, WebIntentsGetAll) { 665 TEST_F(WebDataServiceTest, WebIntentsGetAll) {
643 WebIntentsConsumer consumer; 666 WebIntentsConsumer consumer;
644 667
645 WebIntentServiceData service; 668 WebIntentServiceData service;
646 service.service_url = GURL("http://google.com"); 669 service.service_url = GURL("http://google.com");
647 service.action = ASCIIToUTF16("share"); 670 service.action = ASCIIToUTF16("share");
648 service.type = ASCIIToUTF16("image/*"); 671 service.type = ASCIIToUTF16("image/*");
649 wds_->AddWebIntent(service); 672 wds_->AddWebIntent(service);
650 673
651 service.action = ASCIIToUTF16("edit"); 674 service.action = ASCIIToUTF16("edit");
652 wds_->AddWebIntent(service); 675 wds_->AddWebIntent(service);
653 676
654 wds_->GetAllWebIntents(&consumer); 677 wds_->GetAllWebIntents(&consumer);
655 WebIntentsConsumer::WaitUntilCalled(); 678 WebIntentsConsumer::WaitUntilCalled();
656 ASSERT_EQ(2U, consumer.intents.size()); 679 ASSERT_EQ(2U, consumer.intents.size());
657 680
658 if (consumer.intents[0].action != ASCIIToUTF16("edit")) 681 if (consumer.intents[0].action != ASCIIToUTF16("edit"))
659 std::swap(consumer.intents[0],consumer.intents[1]); 682 std::swap(consumer.intents[0],consumer.intents[1]);
660 683
661 EXPECT_EQ(service, consumer.intents[0]); 684 EXPECT_EQ(service, consumer.intents[0]);
662 service.action = ASCIIToUTF16("share"); 685 service.action = ASCIIToUTF16("share");
663 EXPECT_EQ(service, consumer.intents[1]); 686 EXPECT_EQ(service, consumer.intents[1]);
664 } 687 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698