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

Side by Side Diff: chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc

Issue 3040022: Add new search engine logos to template url data.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "base/scoped_temp_dir.h" 4 #include "base/scoped_temp_dir.h"
5 #include "base/scoped_vector.h" 5 #include "base/scoped_vector.h"
6 #include "chrome/browser/search_engines/template_url.h" 6 #include "chrome/browser/search_engines/template_url.h"
7 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" 7 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
8 #include "chrome/common/pref_names.h" 8 #include "chrome/common/pref_names.h"
9 #include "chrome/test/testing_profile.h" 9 #include "chrome/test/testing_profile.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 const char pref_data[] = 85 const char pref_data[] =
86 "{ " 86 "{ "
87 " \"search_provider_overrides_version\":1," 87 " \"search_provider_overrides_version\":1,"
88 " \"search_provider_overrides\": [" 88 " \"search_provider_overrides\": ["
89 " { \"name\":\"foo\"," 89 " { \"name\":\"foo\","
90 " \"keyword\":\"fook\"," 90 " \"keyword\":\"fook\","
91 " \"search_url\":\"http://foo.com/s?q={searchTerms}\"," 91 " \"search_url\":\"http://foo.com/s?q={searchTerms}\","
92 " \"favicon_url\":\"http://foi.com/favicon.ico\"," 92 " \"favicon_url\":\"http://foi.com/favicon.ico\","
93 " \"suggest_url\":\"\"," 93 " \"suggest_url\":\"\","
94 " \"encoding\":\"UTF-8\"," 94 " \"encoding\":\"UTF-8\","
95 " \"search_engine_type\":1,"
96 " \"logo_id\":0,"
95 " \"id\":1001" 97 " \"id\":1001"
96 " }" 98 " }"
97 " ]" 99 " ]"
98 "}"; 100 "}";
99 101
100 ScopedTempDir temp_dir; 102 ScopedTempDir temp_dir;
101 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 103 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
102 FilePath preferences_file = temp_dir.path().AppendASCII("Preferences"); 104 FilePath preferences_file = temp_dir.path().AppendASCII("Preferences");
103 file_util::WriteFile(preferences_file, pref_data, sizeof(pref_data)); 105 file_util::WriteFile(preferences_file, pref_data, sizeof(pref_data));
104 106
105 scoped_ptr<PrefService> prefs( 107 scoped_ptr<PrefService> prefs(
106 PrefService::CreateUserPrefService(preferences_file)); 108 PrefService::CreateUserPrefService(preferences_file));
107 TemplateURLPrepopulateData::RegisterUserPrefs(prefs.get()); 109 TemplateURLPrepopulateData::RegisterUserPrefs(prefs.get());
108 110
109 int version = TemplateURLPrepopulateData::GetDataVersion(prefs.get()); 111 int version = TemplateURLPrepopulateData::GetDataVersion(prefs.get());
110 EXPECT_EQ(1, version); 112 EXPECT_EQ(1, version);
111 113
112 ScopedVector<TemplateURL> t_urls; 114 ScopedVector<TemplateURL> t_urls;
113 size_t default_index; 115 size_t default_index;
114 TemplateURLPrepopulateData::GetPrepopulatedEngines( 116 TemplateURLPrepopulateData::GetPrepopulatedEngines(
115 prefs.get(), &(t_urls.get()), &default_index); 117 prefs.get(), &(t_urls.get()), &default_index);
116 118
117 ASSERT_EQ(1u, t_urls.size()); 119 ASSERT_EQ(1u, t_urls.size());
118 EXPECT_EQ(L"foo", t_urls[0]->short_name()); 120 EXPECT_EQ(L"foo", t_urls[0]->short_name());
119 EXPECT_EQ(L"fook", t_urls[0]->keyword()); 121 EXPECT_EQ(L"fook", t_urls[0]->keyword());
120 EXPECT_EQ("foo.com", t_urls[0]->url()->GetHost()); 122 EXPECT_EQ("foo.com", t_urls[0]->url()->GetHost());
121 EXPECT_EQ("foi.com", t_urls[0]->GetFavIconURL().host()); 123 EXPECT_EQ("foi.com", t_urls[0]->GetFavIconURL().host());
122 EXPECT_EQ(1u, t_urls[0]->input_encodings().size()); 124 EXPECT_EQ(1u, t_urls[0]->input_encodings().size());
123 EXPECT_EQ(1001, t_urls[0]->prepopulate_id()); 125 EXPECT_EQ(1001, t_urls[0]->prepopulate_id());
126 EXPECT_EQ(TemplateURLPrepopulateData::SEARCH_ENGINE_GOOGLE,
127 t_urls[0]->search_engine_type());
128 EXPECT_EQ(0, t_urls[0]->logo_id());
124 } 129 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_prepopulate_data.cc ('k') | chrome/browser/views/first_run_search_engine_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698