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

Unified Diff: chrome/browser/search/suggestions/thumbnail_manager_unittest.cc

Issue 299713007: [Suggestions] Adding a Thumbnail Manager for the Suggestions Service (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now swapping Created 6 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
« no previous file with comments | « chrome/browser/search/suggestions/thumbnail_manager_browsertest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search/suggestions/thumbnail_manager_unittest.cc
diff --git a/chrome/browser/search/suggestions/thumbnail_manager_unittest.cc b/chrome/browser/search/suggestions/thumbnail_manager_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e55ee6efa30232912a9f2e4674b90c29ca17abe8
--- /dev/null
+++ b/chrome/browser/search/suggestions/thumbnail_manager_unittest.cc
@@ -0,0 +1,46 @@
+// 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 <string>
+
+#include "chrome/browser/search/suggestions/proto/suggestions.pb.h"
+#include "chrome/browser/search/suggestions/thumbnail_manager.h"
+#include "chrome/test/base/testing_profile.h"
+#include "content/public/test/test_browser_thread_bundle.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "url/gurl.h"
+
+namespace {
+
+const char kTestUrl[] = "http://go.com/";
+const char kTestThumbnailUrl[] = "http://thumb.com/anchor_download_test.png";
+
+class ThumbnailManagerTest : public testing::Test {
+ protected:
+ content::TestBrowserThreadBundle thread_bundle_;
+};
+
+} // namespace
+
+namespace suggestions {
+
+TEST_F(ThumbnailManagerTest, InitializeThumbnailMapTest) {
+ SuggestionsProfile suggestions_profile;
+ ChromeSuggestion* suggestion = suggestions_profile.add_suggestions();
+ suggestion->set_url(kTestUrl);
+ suggestion->set_thumbnail(kTestThumbnailUrl);
+
+ TestingProfile profile;
+ ThumbnailManager thumbnail_manager(&profile);
+ thumbnail_manager.InitializeThumbnailMap(suggestions_profile);
+
+ GURL output;
+ EXPECT_TRUE(thumbnail_manager.GetThumbnailURL(GURL(kTestUrl), &output));
+ EXPECT_EQ(GURL(kTestThumbnailUrl), output);
+
+ EXPECT_FALSE(thumbnail_manager.GetThumbnailURL(GURL("http://b.com"),
+ &output));
+}
+
+} // namespace suggestions
« no previous file with comments | « chrome/browser/search/suggestions/thumbnail_manager_browsertest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698