| 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/message_loop.h" | 7 #include "base/message_loop/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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 test_->DestroyedCallback(this); | 101 test_->DestroyedCallback(this); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void TemplateURLFetcherTestCallbacks::ConfirmAddSearchProvider( | 104 void TemplateURLFetcherTestCallbacks::ConfirmAddSearchProvider( |
| 105 TemplateURL* template_url, | 105 TemplateURL* template_url, |
| 106 Profile* profile) { | 106 Profile* profile) { |
| 107 test_->ConfirmAddSearchProvider(template_url, profile); | 107 test_->ConfirmAddSearchProvider(template_url, profile); |
| 108 } | 108 } |
| 109 | 109 |
| 110 TemplateURLFetcherTest::TemplateURLFetcherTest() | 110 TemplateURLFetcherTest::TemplateURLFetcherTest() |
| 111 : test_server_( | 111 : callbacks_destroyed_(0), |
| 112 content::BrowserThread::GetMessageLoopProxyForThread( | |
| 113 content::BrowserThread::IO)), | |
| 114 callbacks_destroyed_(0), | |
| 115 add_provider_called_(0), | 112 add_provider_called_(0), |
| 116 waiting_for_download_(false) { | 113 waiting_for_download_(false) { |
| 117 base::FilePath src_dir; | 114 base::FilePath src_dir; |
| 118 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)); | 115 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)); |
| 119 test_server_.ServeFilesFromDirectory( | 116 test_server_.ServeFilesFromDirectory( |
| 120 src_dir.AppendASCII("chrome/test/data")); | 117 src_dir.AppendASCII("chrome/test/data")); |
| 121 } | 118 } |
| 122 | 119 |
| 123 void TemplateURLFetcherTest::DestroyedCallback( | 120 void TemplateURLFetcherTest::DestroyedCallback( |
| 124 TemplateURLFetcherTestCallbacks* callbacks) { | 121 TemplateURLFetcherTestCallbacks* callbacks) { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 StartDownload(keyword, osdd_file_name, | 318 StartDownload(keyword, osdd_file_name, |
| 322 TemplateURLFetcher::EXPLICIT_PROVIDER, true); | 319 TemplateURLFetcher::EXPLICIT_PROVIDER, true); |
| 323 ASSERT_EQ(0, add_provider_called_); | 320 ASSERT_EQ(0, add_provider_called_); |
| 324 ASSERT_EQ(1, callbacks_destroyed_); | 321 ASSERT_EQ(1, callbacks_destroyed_); |
| 325 | 322 |
| 326 WaitForDownloadToFinish(); | 323 WaitForDownloadToFinish(); |
| 327 ASSERT_EQ(1, add_provider_called_); | 324 ASSERT_EQ(1, add_provider_called_); |
| 328 ASSERT_EQ(2, callbacks_destroyed_); | 325 ASSERT_EQ(2, callbacks_destroyed_); |
| 329 ASSERT_TRUE(last_callback_template_url_.get()); | 326 ASSERT_TRUE(last_callback_template_url_.get()); |
| 330 } | 327 } |
| OLD | NEW |