OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/component_updater/test/component_updater_service_unitte
st.h" | 5 #include "chrome/browser/component_updater/test/component_updater_service_unitte
st.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/component_updater/component_updater_utils.h" | 13 #include "chrome/browser/component_updater/component_updater_utils.h" |
14 #include "chrome/browser/component_updater/test/test_installer.h" | 14 #include "chrome/browser/component_updater/test/test_installer.h" |
15 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
| 16 #include "chrome/common/chrome_version_info.h" |
16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/resource_controller.h" | 18 #include "content/public/browser/resource_controller.h" |
18 #include "content/public/browser/resource_request_info.h" | 19 #include "content/public/browser/resource_request_info.h" |
19 #include "content/public/browser/resource_throttle.h" | 20 #include "content/public/browser/resource_throttle.h" |
20 #include "libxml/globals.h" | 21 #include "libxml/globals.h" |
21 #include "net/base/upload_bytes_element_reader.h" | 22 #include "net/base/upload_bytes_element_reader.h" |
22 #include "net/url_request/url_fetcher.h" | 23 #include "net/url_request/url_fetcher.h" |
23 #include "net/url_request/url_request_test_util.h" | 24 #include "net/url_request/url_request_test_util.h" |
24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
25 | 26 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 158 |
158 InterceptorFactory::~InterceptorFactory() { | 159 InterceptorFactory::~InterceptorFactory() { |
159 } | 160 } |
160 | 161 |
161 URLRequestPostInterceptor* InterceptorFactory::CreateInterceptor() { | 162 URLRequestPostInterceptor* InterceptorFactory::CreateInterceptor() { |
162 return URLRequestPostInterceptorFactory::CreateInterceptor( | 163 return URLRequestPostInterceptorFactory::CreateInterceptor( |
163 base::FilePath::FromUTF8Unsafe(POST_INTERCEPT_PATH)); | 164 base::FilePath::FromUTF8Unsafe(POST_INTERCEPT_PATH)); |
164 } | 165 } |
165 | 166 |
166 ComponentUpdaterTest::ComponentUpdaterTest() | 167 ComponentUpdaterTest::ComponentUpdaterTest() |
167 : test_config_(NULL), | 168 : post_interceptor_(NULL), |
| 169 test_config_(NULL), |
168 thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { | 170 thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { |
169 // The component updater instance under test. | 171 // The component updater instance under test. |
170 test_config_ = new TestConfigurator; | 172 test_config_ = new TestConfigurator; |
171 component_updater_.reset(ComponentUpdateServiceFactory(test_config_)); | 173 component_updater_.reset( |
| 174 ComponentUpdateServiceFactory(test_config_, |
| 175 chrome::VersionInfo().Version(), |
| 176 chrome::VersionInfo().OSType())); |
172 test_config_->SetComponentUpdateService(component_updater_.get()); | 177 test_config_->SetComponentUpdateService(component_updater_.get()); |
173 | 178 |
174 // The test directory is chrome/test/data/components. | 179 // The test directory is chrome/test/data/components. |
175 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); | 180 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); |
176 test_data_dir_ = test_data_dir_.AppendASCII("components"); | 181 test_data_dir_ = test_data_dir_.AppendASCII("components"); |
177 | 182 |
178 net::URLFetcher::SetEnableInterceptionForTests(true); | 183 net::URLFetcher::SetEnableInterceptionForTests(true); |
179 } | 184 } |
180 | 185 |
181 ComponentUpdaterTest::~ComponentUpdaterTest() { | 186 ComponentUpdaterTest::~ComponentUpdaterTest() { |
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 component_updater()->RemoveObserver(&observer2); | 1601 component_updater()->RemoveObserver(&observer2); |
1597 | 1602 |
1598 test_configurator()->SetLoopCount(1); | 1603 test_configurator()->SetLoopCount(1); |
1599 component_updater()->Start(); | 1604 component_updater()->Start(); |
1600 RunThreads(); | 1605 RunThreads(); |
1601 | 1606 |
1602 component_updater()->Stop(); | 1607 component_updater()->Stop(); |
1603 } | 1608 } |
1604 | 1609 |
1605 } // namespace component_updater | 1610 } // namespace component_updater |
OLD | NEW |