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

Unified Diff: content/browser/web_contents/navigation_entry_impl_unittest.cc

Issue 11876045: [Search] Store and recall search terms using NavigationEntry to improve search term extraction (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: reupload Created 7 years, 11 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 | « content/browser/web_contents/navigation_entry_impl.cc ('k') | content/public/browser/navigation_entry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/navigation_entry_impl_unittest.cc
diff --git a/content/browser/web_contents/navigation_entry_impl_unittest.cc b/content/browser/web_contents/navigation_entry_impl_unittest.cc
index 0e8fa33f6cbcb6e7ab0aca93b88ffbd21c9ad68e..00857ed329fbd123a859e34e9bce92a4a500541f 100644
--- a/content/browser/web_contents/navigation_entry_impl_unittest.cc
+++ b/content/browser/web_contents/navigation_entry_impl_unittest.cc
@@ -217,4 +217,25 @@ TEST_F(NavigationEntryTest, NavigationEntryTimestamps) {
EXPECT_EQ(now, entry1_->GetTimestamp());
}
+// Test extra data stored in the navigation entry.
+TEST_F(NavigationEntryTest, NavigationEntryExtraData) {
+ string16 test_data = ASCIIToUTF16("my search terms");
+ string16 output;
+ entry1_->SetExtraData("search_terms", test_data);
+
+ EXPECT_FALSE(entry1_->GetExtraData("non_existent_key", &output));
+ EXPECT_EQ(ASCIIToUTF16(""), output);
+ EXPECT_TRUE(entry1_->GetExtraData("search_terms", &output));
+ EXPECT_EQ(test_data, output);
+ // Data is cleared.
+ entry1_->ClearExtraData("search_terms");
+ // Content in |output| is not modified if data is not present at the key.
+ EXPECT_FALSE(entry1_->GetExtraData("search_terms", &output));
+ EXPECT_EQ(test_data, output);
+ // Using an empty string shows that the data is not present in the map.
+ string16 output2;
+ EXPECT_FALSE(entry1_->GetExtraData("search_terms", &output2));
+ EXPECT_EQ(ASCIIToUTF16(""), output2);
+}
+
} // namespace content
« no previous file with comments | « content/browser/web_contents/navigation_entry_impl.cc ('k') | content/public/browser/navigation_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698