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

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: Merge to head Created 9 years, 2 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 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("share");
James Hawkins 2011/10/06 17:46:04 Might be a better test to have two intents for goo
Greg Billock 2011/10/06 20:21:00 Done.
648 service.type = ASCIIToUTF16("image/*");
649 wds_->AddWebIntent(service);
650
651 wds_->GetWebIntentsForURL(
652 ASCIIToUTF16("share"),
653 UTF8ToUTF16(service.service_url.spec()),
654 &consumer);
655 WebIntentsConsumer::WaitUntilCalled();
656 ASSERT_EQ(1U, consumer.intents.size());
657 EXPECT_EQ(service, consumer.intents[0]);
658 }
659
642 TEST_F(WebDataServiceTest, WebIntentsGetAll) { 660 TEST_F(WebDataServiceTest, WebIntentsGetAll) {
643 WebIntentsConsumer consumer; 661 WebIntentsConsumer consumer;
644 662
645 WebIntentServiceData service; 663 WebIntentServiceData service;
646 service.service_url = GURL("http://google.com"); 664 service.service_url = GURL("http://google.com");
647 service.action = ASCIIToUTF16("share"); 665 service.action = ASCIIToUTF16("share");
648 service.type = ASCIIToUTF16("image/*"); 666 service.type = ASCIIToUTF16("image/*");
649 wds_->AddWebIntent(service); 667 wds_->AddWebIntent(service);
650 668
651 service.action = ASCIIToUTF16("edit"); 669 service.action = ASCIIToUTF16("edit");
652 wds_->AddWebIntent(service); 670 wds_->AddWebIntent(service);
653 671
654 wds_->GetAllWebIntents(&consumer); 672 wds_->GetAllWebIntents(&consumer);
655 WebIntentsConsumer::WaitUntilCalled(); 673 WebIntentsConsumer::WaitUntilCalled();
656 ASSERT_EQ(2U, consumer.intents.size()); 674 ASSERT_EQ(2U, consumer.intents.size());
657 675
658 if (consumer.intents[0].action != ASCIIToUTF16("edit")) 676 if (consumer.intents[0].action != ASCIIToUTF16("edit"))
659 std::swap(consumer.intents[0],consumer.intents[1]); 677 std::swap(consumer.intents[0],consumer.intents[1]);
660 678
661 EXPECT_EQ(service, consumer.intents[0]); 679 EXPECT_EQ(service, consumer.intents[0]);
662 service.action = ASCIIToUTF16("share"); 680 service.action = ASCIIToUTF16("share");
663 EXPECT_EQ(service, consumer.intents[1]); 681 EXPECT_EQ(service, consumer.intents[1]);
664 } 682 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698