OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/component_updater_service.h" | 5 #include "chrome/browser/component_updater/component_updater_service.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "chrome/browser/component_updater/component_updater_interceptor.h" | 11 #include "chrome/browser/component_updater/component_updater_interceptor.h" |
12 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
14 #include "chrome/test/base/test_notification_tracker.h" | 14 #include "chrome/test/base/test_notification_tracker.h" |
15 #include "chrome/test/base/test_url_request_context_getter.h" | 15 #include "chrome/test/base/test_url_request_context_getter.h" |
| 16 #include "chrome/test/testing_browser_process_test.h" |
16 #include "content/browser/browser_thread.h" | 17 #include "content/browser/browser_thread.h" |
17 #include "content/common/notification_observer.h" | 18 #include "content/common/notification_observer.h" |
18 #include "content/common/notification_service.h" | 19 #include "content/common/notification_service.h" |
19 #include "content/common/url_fetcher.h" | 20 #include "content/common/url_fetcher.h" |
20 | 21 |
21 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
22 #include "libxml/globals.h" | 23 #include "libxml/globals.h" |
23 | 24 |
24 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
25 | 26 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06, | 99 0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06, |
99 0x06,0x01}; | 100 0x06,0x01}; |
100 | 101 |
101 const char header_ok_reply[] = | 102 const char header_ok_reply[] = |
102 "HTTP/1.1 200 OK\0" | 103 "HTTP/1.1 200 OK\0" |
103 "Content-type: text/html\0" | 104 "Content-type: text/html\0" |
104 "\0"; | 105 "\0"; |
105 } // namespace | 106 } // namespace |
106 | 107 |
107 // Common fixture for all the component updater tests. | 108 // Common fixture for all the component updater tests. |
108 class ComponentUpdaterTest : public testing::Test { | 109 class ComponentUpdaterTest : public TestingBrowserProcessTest { |
109 public: | 110 public: |
110 ComponentUpdaterTest() : component_updater_(NULL) { | 111 ComponentUpdaterTest() : component_updater_(NULL) { |
111 // The component updater instance under test. | 112 // The component updater instance under test. |
112 component_updater_.reset( | 113 component_updater_.reset( |
113 ComponentUpdateServiceFactory(new TestConfigurator)); | 114 ComponentUpdateServiceFactory(new TestConfigurator)); |
114 // The test directory is chrome/test/data/components. | 115 // The test directory is chrome/test/data/components. |
115 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); | 116 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); |
116 test_data_dir_ = test_data_dir_.AppendASCII("components"); | 117 test_data_dir_ = test_data_dir_.AppendASCII("components"); |
117 | 118 |
118 // Subscribe to all component updater notifications. | 119 // Subscribe to all component updater notifications. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 286 |
286 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error()); | 287 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error()); |
287 EXPECT_EQ(1, static_cast<TestInstaller*>(com1.installer)->install_count()); | 288 EXPECT_EQ(1, static_cast<TestInstaller*>(com1.installer)->install_count()); |
288 | 289 |
289 component_updater()->Stop(); | 290 component_updater()->Stop(); |
290 delete com1.installer; | 291 delete com1.installer; |
291 delete com2.installer; | 292 delete com2.installer; |
292 xmlCleanupGlobals(); | 293 xmlCleanupGlobals(); |
293 } | 294 } |
294 | 295 |
OLD | NEW |