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

Unified Diff: chrome/browser/extensions/api/omnibox/omnibox_unittest.cc

Issue 14960004: Fix mismatched parameter expectations between chrome.omnibox setDefaultSuggestion and SuggestResult (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@omniboxJSON
Patch Set: Modify SetOmniboxDefaultSuggestion to generate a dictionary compatible with api::omnibox::SuggestRe… Created 7 years, 7 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
Index: chrome/browser/extensions/api/omnibox/omnibox_unittest.cc
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc b/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc
index c357fc8f8880475991e90593eda59245f2561af9..f1ab1ed65221c9155d086e378835f981827b5ba7 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc
+++ b/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc
@@ -13,6 +13,7 @@ namespace extensions {
namespace omnibox = api::omnibox;
namespace SendSuggestions = omnibox::SendSuggestions;
+namespace SetDefaultSuggestion = omnibox::SetDefaultSuggestion;
namespace {
@@ -232,4 +233,43 @@ TEST(ExtensionOmniboxTest, DescriptionStylesCombine2) {
*params->suggest_results[0]));
}
+// 0123456789
+// uuuuu
+// + mmmmm
+// + mmm
+// + ddd
+// + ddd
+// = 77777nnnnn
+TEST(ExtensionOmniboxTest, DefaultSuggestResult) {
+ // Default suggestions should not have a content parameter.
+ scoped_ptr<ListValue> list = ListBuilder()
+ .Append(DictionaryBuilder()
+ .Set("description", "description")
+ .Set("descriptionStyles", ListBuilder()
+ .Append(DictionaryBuilder()
+ .Set("type", "url")
+ .Set("offset", 0)
+ .Set("length", 5))
+ .Append(DictionaryBuilder()
+ .Set("type", "match")
+ .Set("offset", 0)
+ .Set("length", 5))
+ .Append(DictionaryBuilder()
+ .Set("type", "match")
+ .Set("offset", 0)
+ .Set("length", 3))
+ .Append(DictionaryBuilder()
+ .Set("type", "dim")
+ .Set("offset", 2)
+ .Set("length", 3))
+ .Append(DictionaryBuilder()
+ .Set("type", "dim")
+ .Set("offset", 0)
+ .Set("length", 3)))).Build();
+
+ scoped_ptr<SetDefaultSuggestion::Params> params(
+ SetDefaultSuggestion::Params::Create(*list));
+ EXPECT_TRUE(params);
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698