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

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: New test 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
« no previous file with comments | « chrome/browser/webdata/web_data_service.cc ('k') | chrome/browser/webdata/web_intents_table.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
James Hawkins 2011/10/06 20:55:03 Wha? Why did you make this share1? The point of
Greg Billock 2011/10/06 21:37:57 Hmm. I see what you're saying about naming. The ex
James Hawkins 2011/10/06 21:42:32 *shrugs*
Greg Billock 2011/10/06 22:13:12 As in "indices aren't that bad" or as in "oh well,
James Hawkins 2011/10/07 20:29:48 Per-offline, I wouldn't try to optimize this yet (
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 ASCIIToUTF16("share"),
657 UTF8ToUTF16(service.service_url.spec()),
658 &consumer);
659 WebIntentsConsumer::WaitUntilCalled();
660 ASSERT_EQ(1U, consumer.intents.size());
661 EXPECT_EQ(service, consumer.intents[0]);
662 }
663
642 TEST_F(WebDataServiceTest, WebIntentsGetAll) { 664 TEST_F(WebDataServiceTest, WebIntentsGetAll) {
643 WebIntentsConsumer consumer; 665 WebIntentsConsumer consumer;
644 666
645 WebIntentServiceData service; 667 WebIntentServiceData service;
646 service.service_url = GURL("http://google.com"); 668 service.service_url = GURL("http://google.com");
647 service.action = ASCIIToUTF16("share"); 669 service.action = ASCIIToUTF16("share");
648 service.type = ASCIIToUTF16("image/*"); 670 service.type = ASCIIToUTF16("image/*");
649 wds_->AddWebIntent(service); 671 wds_->AddWebIntent(service);
650 672
651 service.action = ASCIIToUTF16("edit"); 673 service.action = ASCIIToUTF16("edit");
652 wds_->AddWebIntent(service); 674 wds_->AddWebIntent(service);
653 675
654 wds_->GetAllWebIntents(&consumer); 676 wds_->GetAllWebIntents(&consumer);
655 WebIntentsConsumer::WaitUntilCalled(); 677 WebIntentsConsumer::WaitUntilCalled();
656 ASSERT_EQ(2U, consumer.intents.size()); 678 ASSERT_EQ(2U, consumer.intents.size());
657 679
658 if (consumer.intents[0].action != ASCIIToUTF16("edit")) 680 if (consumer.intents[0].action != ASCIIToUTF16("edit"))
659 std::swap(consumer.intents[0],consumer.intents[1]); 681 std::swap(consumer.intents[0],consumer.intents[1]);
660 682
661 EXPECT_EQ(service, consumer.intents[0]); 683 EXPECT_EQ(service, consumer.intents[0]);
662 service.action = ASCIIToUTF16("share"); 684 service.action = ASCIIToUTF16("share");
663 EXPECT_EQ(service, consumer.intents[1]); 685 EXPECT_EQ(service, consumer.intents[1]);
664 } 686 }
OLDNEW
« no previous file with comments | « chrome/browser/webdata/web_data_service.cc ('k') | chrome/browser/webdata/web_intents_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698