Chromium Code Reviews| 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/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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &osdd_full_path)); | 140 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &osdd_full_path)); |
| 141 osdd_full_path = osdd_full_path.AppendASCII(osdd_file_name); | 141 osdd_full_path = osdd_full_path.AppendASCII(osdd_file_name); |
| 142 ASSERT_TRUE(file_util::PathExists(osdd_full_path)); | 142 ASSERT_TRUE(file_util::PathExists(osdd_full_path)); |
| 143 ASSERT_FALSE(file_util::DirectoryExists(osdd_full_path)); | 143 ASSERT_FALSE(file_util::DirectoryExists(osdd_full_path)); |
| 144 } | 144 } |
| 145 | 145 |
| 146 // Start the fetch. | 146 // Start the fetch. |
| 147 GURL osdd_url = test_server_.GetURL("files/" + osdd_file_name); | 147 GURL osdd_url = test_server_.GetURL("files/" + osdd_file_name); |
| 148 GURL favicon_url; | 148 GURL favicon_url; |
| 149 test_util_.profile()->GetTemplateURLFetcher()->ScheduleDownload( | 149 test_util_.profile()->GetTemplateURLFetcher()->ScheduleDownload( |
| 150 keyword, osdd_url, favicon_url, new TemplateURLFetcherTestCallbacks(this), | 150 keyword, osdd_url, favicon_url, NULL /* web_contents */, |
|
Peter Kasting
2012/03/08 20:46:27
Nit: No need for the /* */ comment since none of t
| |
| 151 provider_type); | 151 new TemplateURLFetcherTestCallbacks(this), provider_type); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void TemplateURLFetcherTest::WaitForDownloadToFinish() { | 154 void TemplateURLFetcherTest::WaitForDownloadToFinish() { |
| 155 ASSERT_FALSE(waiting_for_download_); | 155 ASSERT_FALSE(waiting_for_download_); |
| 156 waiting_for_download_ = true; | 156 waiting_for_download_ = true; |
| 157 MessageLoop::current()->Run(); | 157 MessageLoop::current()->Run(); |
| 158 waiting_for_download_ = false; | 158 waiting_for_download_ = false; |
| 159 } | 159 } |
| 160 | 160 |
| 161 TEST_F(TemplateURLFetcherTest, BasicAutodetectedTest) { | 161 TEST_F(TemplateURLFetcherTest, BasicAutodetectedTest) { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 StartDownload(keyword, osdd_file_name, | 305 StartDownload(keyword, osdd_file_name, |
| 306 TemplateURLFetcher::EXPLICIT_PROVIDER, true); | 306 TemplateURLFetcher::EXPLICIT_PROVIDER, true); |
| 307 ASSERT_EQ(0, add_provider_called_); | 307 ASSERT_EQ(0, add_provider_called_); |
| 308 ASSERT_EQ(1, callbacks_destroyed_); | 308 ASSERT_EQ(1, callbacks_destroyed_); |
| 309 | 309 |
| 310 WaitForDownloadToFinish(); | 310 WaitForDownloadToFinish(); |
| 311 ASSERT_EQ(1, add_provider_called_); | 311 ASSERT_EQ(1, add_provider_called_); |
| 312 ASSERT_EQ(2, callbacks_destroyed_); | 312 ASSERT_EQ(2, callbacks_destroyed_); |
| 313 ASSERT_TRUE(last_callback_template_url_.get()); | 313 ASSERT_TRUE(last_callback_template_url_.get()); |
| 314 } | 314 } |
| OLD | NEW |