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

Unified Diff: chrome/browser/webdata/web_intents_table_unittest.cc

Issue 7633011: Added WebIntents GetAll support (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix review nit Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/webdata/web_intents_table.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/webdata/web_intents_table_unittest.cc
diff --git a/chrome/browser/webdata/web_intents_table_unittest.cc b/chrome/browser/webdata/web_intents_table_unittest.cc
index f6367bc2787d90c096e82fc41ec2c08137086c01..6955affee92378d379c4c8a254bc73a548338242 100644
--- a/chrome/browser/webdata/web_intents_table_unittest.cc
+++ b/chrome/browser/webdata/web_intents_table_unittest.cc
@@ -18,6 +18,7 @@ namespace {
GURL test_url("http://google.com/");
string16 test_action = ASCIIToUTF16("http://webintents.org/intents/share");
+string16 test_action_2 = ASCIIToUTF16("http://webintents.org/intents/view");
string16 mime_image = ASCIIToUTF16("image/*");
string16 mime_video = ASCIIToUTF16("video/*");
@@ -92,4 +93,31 @@ TEST_F(WebIntentsTableTest, SetMultipleIntents) {
intent.type = mime_image;
EXPECT_EQ(intent, intents[0]);
}
+
+// Test we support getting all intents independent of action.
+TEST_F(WebIntentsTableTest, GetAllIntents) {
+ std::vector<WebIntentData> intents;
+
+ WebIntentData intent;
+ intent.service_url = test_url;
+ intent.action = test_action;
+ intent.type = mime_image;
+ EXPECT_TRUE(IntentsTable()->SetWebIntent(intent));
+
+ intent.action = test_action_2;
+ EXPECT_TRUE(IntentsTable()->SetWebIntent(intent));
+
+ // Recover stored intents from DB.
+ EXPECT_TRUE(IntentsTable()->GetAllWebIntents(&intents));
+ ASSERT_EQ(2U, intents.size());
+
+ // WebIntentsTable does not guarantee order, so ensure order here.
+ if (intents[0].type == test_action_2)
+ std::swap(intents[0], intents[1]);
+
+ EXPECT_EQ(intent, intents[1]);
+
+ intent.action = test_action;
+ EXPECT_EQ(intent, intents[0]);
+}
} // namespace
« no previous file with comments | « chrome/browser/webdata/web_intents_table.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698