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

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

Issue 410673002: [Suggestions] Moving suggestions code to a new component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix deps Created 6 years, 5 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/search/suggestions/suggestions_store_unittest.cc
diff --git a/chrome/browser/search/suggestions/suggestions_store_unittest.cc b/chrome/browser/search/suggestions/suggestions_store_unittest.cc
deleted file mode 100644
index 118117126b48b9e813251c30f1d9e60a1e3b8528..0000000000000000000000000000000000000000
--- a/chrome/browser/search/suggestions/suggestions_store_unittest.cc
+++ /dev/null
@@ -1,65 +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 "chrome/browser/search/suggestions/suggestions_store.h"
-
-#include "chrome/browser/search/suggestions/proto/suggestions.pb.h"
-#include "chrome/test/base/testing_pref_service_syncable.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace suggestions {
-
-namespace {
-
-const char kTestTitle[] = "Foo site";
-const char kTestUrl[] = "http://foo.com/";
-
-SuggestionsProfile CreateTestSuggestions() {
- SuggestionsProfile suggestions;
- ChromeSuggestion* suggestion = suggestions.add_suggestions();
- suggestion->set_url(kTestUrl);
- suggestion->set_title(kTestTitle);
- return suggestions;
-}
-
-void ValidateSuggestions(const SuggestionsProfile& expected,
- const SuggestionsProfile& actual) {
- EXPECT_EQ(expected.suggestions_size(), actual.suggestions_size());
- for (int i = 0; i < expected.suggestions_size(); ++i) {
- EXPECT_EQ(expected.suggestions(i).url(), actual.suggestions(i).url());
- EXPECT_EQ(expected.suggestions(i).title(), actual.suggestions(i).title());
- EXPECT_EQ(expected.suggestions(i).favicon_url(),
- actual.suggestions(i).favicon_url());
- EXPECT_EQ(expected.suggestions(i).thumbnail(),
- actual.suggestions(i).thumbnail());
- }
-}
-
-} // namespace
-
-TEST(SuggestionsStoreTest, LoadStoreClear) {
- TestingPrefServiceSyncable prefs;
- SuggestionsStore::RegisterProfilePrefs(prefs.registry());
- SuggestionsStore suggestions_store(&prefs);
-
- const SuggestionsProfile suggestions = CreateTestSuggestions();
- const SuggestionsProfile empty_suggestions;
- SuggestionsProfile recovered_suggestions;
-
- // Attempt to load when prefs are empty.
- EXPECT_FALSE(suggestions_store.LoadSuggestions(&recovered_suggestions));
- ValidateSuggestions(empty_suggestions, recovered_suggestions);
-
- // Store then reload.
- EXPECT_TRUE(suggestions_store.StoreSuggestions(suggestions));
- EXPECT_TRUE(suggestions_store.LoadSuggestions(&recovered_suggestions));
- ValidateSuggestions(suggestions, recovered_suggestions);
-
- // Clear.
- suggestions_store.ClearSuggestions();
- EXPECT_FALSE(suggestions_store.LoadSuggestions(&recovered_suggestions));
- ValidateSuggestions(empty_suggestions, recovered_suggestions);
-}
-
-} // namespace suggestions
« no previous file with comments | « chrome/browser/search/suggestions/suggestions_store.cc ('k') | chrome/browser/search/suggestions/thumbnail_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698