| 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 "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/component_updater/component_updater_interceptor.h" | 12 #include "chrome/browser/component_updater/component_updater_interceptor.h" |
| 13 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
| 14 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
| 15 #include "chrome/test/base/test_notification_tracker.h" | 15 #include "chrome/test/base/test_notification_tracker.h" |
| 16 #include "chrome/test/base/test_url_request_context_getter.h" | 16 #include "chrome/test/base/test_url_request_context_getter.h" |
| 17 #include "chrome/test/base/testing_browser_process_test.h" | |
| 18 #include "content/browser/browser_thread.h" | 17 #include "content/browser/browser_thread.h" |
| 19 #include "content/common/notification_observer.h" | 18 #include "content/common/notification_observer.h" |
| 20 #include "content/common/notification_service.h" | 19 #include "content/common/notification_service.h" |
| 21 #include "content/common/url_fetcher.h" | 20 #include "content/common/url_fetcher.h" |
| 22 | 21 |
| 23 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
| 24 #include "libxml/globals.h" | 23 #include "libxml/globals.h" |
| 25 | 24 |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 26 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06, | 112 0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06, |
| 114 0x06,0x01}; | 113 0x06,0x01}; |
| 115 | 114 |
| 116 const char header_ok_reply[] = | 115 const char header_ok_reply[] = |
| 117 "HTTP/1.1 200 OK\0" | 116 "HTTP/1.1 200 OK\0" |
| 118 "Content-type: text/html\0" | 117 "Content-type: text/html\0" |
| 119 "\0"; | 118 "\0"; |
| 120 } // namespace | 119 } // namespace |
| 121 | 120 |
| 122 // Common fixture for all the component updater tests. | 121 // Common fixture for all the component updater tests. |
| 123 class ComponentUpdaterTest : public TestingBrowserProcessTest { | 122 class ComponentUpdaterTest : public testing::Test { |
| 124 public: | 123 public: |
| 125 ComponentUpdaterTest() : component_updater_(NULL), test_config_(NULL) { | 124 ComponentUpdaterTest() : component_updater_(NULL), test_config_(NULL) { |
| 126 // The component updater instance under test. | 125 // The component updater instance under test. |
| 127 test_config_ = new TestConfigurator; | 126 test_config_ = new TestConfigurator; |
| 128 component_updater_.reset(ComponentUpdateServiceFactory(test_config_)); | 127 component_updater_.reset(ComponentUpdateServiceFactory(test_config_)); |
| 129 // The test directory is chrome/test/data/components. | 128 // The test directory is chrome/test/data/components. |
| 130 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); | 129 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); |
| 131 test_data_dir_ = test_data_dir_.AppendASCII("components"); | 130 test_data_dir_ = test_data_dir_.AppendASCII("components"); |
| 132 | 131 |
| 133 // Subscribe to all component updater notifications. | 132 // Subscribe to all component updater notifications. |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 349 |
| 351 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error()); | 350 EXPECT_EQ(0, static_cast<TestInstaller*>(com1.installer)->error()); |
| 352 EXPECT_EQ(1, static_cast<TestInstaller*>(com1.installer)->install_count()); | 351 EXPECT_EQ(1, static_cast<TestInstaller*>(com1.installer)->install_count()); |
| 353 EXPECT_EQ(2, interceptor->hit_count()); | 352 EXPECT_EQ(2, interceptor->hit_count()); |
| 354 | 353 |
| 355 component_updater()->Stop(); | 354 component_updater()->Stop(); |
| 356 delete com1.installer; | 355 delete com1.installer; |
| 357 delete com2.installer; | 356 delete com2.installer; |
| 358 xmlCleanupGlobals(); | 357 xmlCleanupGlobals(); |
| 359 } | 358 } |
| OLD | NEW |