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

Unified Diff: components/omnibox/search_suggestion_parser_unittest.cc

Issue 669573005: Add a class to parse answer json. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix case on "copyright" Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/omnibox/search_suggestion_parser.cc ('k') | components/omnibox/suggestion_answer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/omnibox/search_suggestion_parser_unittest.cc
diff --git a/components/omnibox/search_suggestion_parser_unittest.cc b/components/omnibox/search_suggestion_parser_unittest.cc
deleted file mode 100644
index 0e193f4f27bd0e6f8ba33cb542a4fe75cc7b7092..0000000000000000000000000000000000000000
--- a/components/omnibox/search_suggestion_parser_unittest.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/omnibox/search_suggestion_parser.h"
-
-#include "base/json/json_reader.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/values.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "url/gurl.h"
-
-namespace {
-
-scoped_ptr<base::DictionaryValue> AsDictionary(const std::string& json) {
- base::Value* value = base::JSONReader::Read(json);
- base::DictionaryValue* dict;
- if (value && value->GetAsDictionary(&dict))
- return scoped_ptr<base::DictionaryValue>(dict);
-
- delete value;
- return scoped_ptr<base::DictionaryValue>(new base::DictionaryValue);
-}
-
-} // namespace
-
-TEST(SearchSuggestionParser, GetAnswersImageURLsWithoutImagelines) {
- std::vector<GURL> urls;
-
- // No "l" entry in the dictionary.
- SearchSuggestionParser::GetAnswersImageURLs(AsDictionary("").get(), &urls);
- EXPECT_TRUE(urls.empty());
-
- // Empty "l" entry in the dictionary.
- SearchSuggestionParser::GetAnswersImageURLs(
- AsDictionary("{ \"l\" : {} } ").get(), &urls);
- EXPECT_TRUE(urls.empty());
-}
-
-TEST(SearchSuggestionParser, GetAnswersImageURLsWithValidImage) {
- std::vector<GURL> urls;
-
- const char answer_json[] =
- "{ \"l\" : [{\"il\": { \"i\": {\"d\": "
- "\"//ssl.gstatic.com/foo.png\",\"t\": 3}}}]}";
- SearchSuggestionParser::GetAnswersImageURLs(AsDictionary(answer_json).get(),
- &urls);
- ASSERT_EQ(1U, urls.size());
- EXPECT_EQ("https://ssl.gstatic.com/foo.png", urls[0].spec());
-}
« no previous file with comments | « components/omnibox/search_suggestion_parser.cc ('k') | components/omnibox/suggestion_answer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698