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

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

Issue 9811022: Misc. small cleanups to minimize TemplateURL refactoring diffs: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 4
5 #include "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/search_engines/template_url.h" 10 #include "chrome/browser/search_engines/template_url.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 TemplateURLFetcher::AUTODETECTED_PROVIDER, true); 193 TemplateURLFetcher::AUTODETECTED_PROVIDER, true);
194 ASSERT_EQ(0, add_provider_called_); 194 ASSERT_EQ(0, add_provider_called_);
195 ASSERT_EQ(0, callbacks_destroyed_); 195 ASSERT_EQ(0, callbacks_destroyed_);
196 196
197 struct { 197 struct {
198 std::string description; 198 std::string description;
199 std::string osdd_file_name; 199 std::string osdd_file_name;
200 string16 keyword; 200 string16 keyword;
201 TemplateURLFetcher::ProviderType provider_type; 201 TemplateURLFetcher::ProviderType provider_type;
202 } test_cases[] = { 202 } test_cases[] = {
203 { "Duplicate keyword and osdd url with autodetected provider.", 203 { "Duplicate osdd url with autodetected provider.", osdd_file_name,
204 osdd_file_name, keyword, TemplateURLFetcher::AUTODETECTED_PROVIDER }, 204 keyword + ASCIIToUTF16("1"),
205 { "Duplicate keyword and osdd url with explicit provider.", 205 TemplateURLFetcher::AUTODETECTED_PROVIDER },
206 osdd_file_name, keyword, TemplateURLFetcher::EXPLICIT_PROVIDER }, 206 { "Duplicate keyword with autodetected provider.", osdd_file_name + "1",
207 { "Duplicate osdd url with explicit provider.", 207 keyword, TemplateURLFetcher::AUTODETECTED_PROVIDER },
208 osdd_file_name, keyword + ASCIIToUTF16("1"), 208 { "Duplicate osdd url with explicit provider.", osdd_file_name,
209 TemplateURLFetcher::EXPLICIT_PROVIDER }, 209 string16(), TemplateURLFetcher::EXPLICIT_PROVIDER },
210 { "Duplicate keyword with explicit provider.",
211 osdd_file_name + "1", keyword, TemplateURLFetcher::EXPLICIT_PROVIDER }
212 }; 210 };
213 211
214 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { 212 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) {
215 StartDownload(test_cases[i].keyword, test_cases[i].osdd_file_name, 213 StartDownload(test_cases[i].keyword, test_cases[i].osdd_file_name,
216 test_cases[i].provider_type, false); 214 test_cases[i].provider_type, false);
217 ASSERT_EQ( 215 ASSERT_EQ(
218 1, 216 1,
219 test_util_.profile()->GetTemplateURLFetcher()->requests_count()) << 217 test_util_.profile()->GetTemplateURLFetcher()->requests_count()) <<
220 test_cases[i].description; 218 test_cases[i].description;
221 ASSERT_EQ(i + 1, static_cast<size_t>(callbacks_destroyed_)); 219 ASSERT_EQ(i + 1, static_cast<size_t>(callbacks_destroyed_));
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 StartDownload(keyword, osdd_file_name, 315 StartDownload(keyword, osdd_file_name,
318 TemplateURLFetcher::EXPLICIT_PROVIDER, true); 316 TemplateURLFetcher::EXPLICIT_PROVIDER, true);
319 ASSERT_EQ(0, add_provider_called_); 317 ASSERT_EQ(0, add_provider_called_);
320 ASSERT_EQ(1, callbacks_destroyed_); 318 ASSERT_EQ(1, callbacks_destroyed_);
321 319
322 WaitForDownloadToFinish(); 320 WaitForDownloadToFinish();
323 ASSERT_EQ(1, add_provider_called_); 321 ASSERT_EQ(1, add_provider_called_);
324 ASSERT_EQ(2, callbacks_destroyed_); 322 ASSERT_EQ(2, callbacks_destroyed_);
325 ASSERT_TRUE(last_callback_template_url_.get()); 323 ASSERT_TRUE(last_callback_template_url_.get());
326 } 324 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698