OLD | NEW |
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/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/search_engines/template_url.h" | 10 #include "chrome/browser/search_engines/template_url.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 void TemplateURLFetcherTest::StartDownload( | 138 void TemplateURLFetcherTest::StartDownload( |
139 const string16& keyword, | 139 const string16& keyword, |
140 const std::string& osdd_file_name, | 140 const std::string& osdd_file_name, |
141 TemplateURLFetcher::ProviderType provider_type, | 141 TemplateURLFetcher::ProviderType provider_type, |
142 bool check_that_file_exists) { | 142 bool check_that_file_exists) { |
143 | 143 |
144 if (check_that_file_exists) { | 144 if (check_that_file_exists) { |
145 base::FilePath osdd_full_path; | 145 base::FilePath osdd_full_path; |
146 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &osdd_full_path)); | 146 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &osdd_full_path)); |
147 osdd_full_path = osdd_full_path.AppendASCII(osdd_file_name); | 147 osdd_full_path = osdd_full_path.AppendASCII(osdd_file_name); |
148 ASSERT_TRUE(file_util::PathExists(osdd_full_path)); | 148 ASSERT_TRUE(base::PathExists(osdd_full_path)); |
149 ASSERT_FALSE(file_util::DirectoryExists(osdd_full_path)); | 149 ASSERT_FALSE(file_util::DirectoryExists(osdd_full_path)); |
150 } | 150 } |
151 | 151 |
152 // Start the fetch. | 152 // Start the fetch. |
153 GURL osdd_url = test_server_.GetURL("/" + osdd_file_name); | 153 GURL osdd_url = test_server_.GetURL("/" + osdd_file_name); |
154 GURL favicon_url; | 154 GURL favicon_url; |
155 TemplateURLFetcherFactory::GetForProfile( | 155 TemplateURLFetcherFactory::GetForProfile( |
156 test_util_.profile())->ScheduleDownload( | 156 test_util_.profile())->ScheduleDownload( |
157 keyword, osdd_url, favicon_url, NULL, | 157 keyword, osdd_url, favicon_url, NULL, |
158 new TemplateURLFetcherTestCallbacks(this), provider_type); | 158 new TemplateURLFetcherTestCallbacks(this), provider_type); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 StartDownload(keyword, osdd_file_name, | 322 StartDownload(keyword, osdd_file_name, |
323 TemplateURLFetcher::EXPLICIT_PROVIDER, true); | 323 TemplateURLFetcher::EXPLICIT_PROVIDER, true); |
324 ASSERT_EQ(0, add_provider_called_); | 324 ASSERT_EQ(0, add_provider_called_); |
325 ASSERT_EQ(1, callbacks_destroyed_); | 325 ASSERT_EQ(1, callbacks_destroyed_); |
326 | 326 |
327 WaitForDownloadToFinish(); | 327 WaitForDownloadToFinish(); |
328 ASSERT_EQ(1, add_provider_called_); | 328 ASSERT_EQ(1, add_provider_called_); |
329 ASSERT_EQ(2, callbacks_destroyed_); | 329 ASSERT_EQ(2, callbacks_destroyed_); |
330 ASSERT_TRUE(last_callback_template_url_.get()); | 330 ASSERT_TRUE(last_callback_template_url_.get()); |
331 } | 331 } |
OLD | NEW |