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 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/browser/component_updater/component_updater_resource_throttle.h
" | 17 #include "chrome/browser/component_updater/component_updater_resource_throttle.h
" |
18 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
19 #include "components/component_updater/component_updater_utils.h" | 19 #include "components/update_client/test/test_configurator.h" |
20 #include "components/component_updater/test/test_configurator.h" | 20 #include "components/update_client/test/test_installer.h" |
21 #include "components/component_updater/test/test_installer.h" | 21 #include "components/update_client/test/url_request_post_interceptor.h" |
22 #include "components/component_updater/test/url_request_post_interceptor.h" | 22 #include "components/update_client/utils.h" |
23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/browser/resource_controller.h" | 24 #include "content/public/browser/resource_controller.h" |
25 #include "content/public/browser/resource_request_info.h" | 25 #include "content/public/browser/resource_request_info.h" |
26 #include "content/public/browser/resource_throttle.h" | 26 #include "content/public/browser/resource_throttle.h" |
27 #include "libxml/globals.h" | 27 #include "libxml/globals.h" |
28 #include "net/base/upload_bytes_element_reader.h" | 28 #include "net/base/upload_bytes_element_reader.h" |
29 #include "net/url_request/test_url_request_interceptor.h" | 29 #include "net/url_request/test_url_request_interceptor.h" |
30 #include "net/url_request/url_request.h" | 30 #include "net/url_request/url_request.h" |
31 #include "net/url_request/url_request_test_util.h" | 31 #include "net/url_request/url_request_test_util.h" |
32 #include "url/gurl.h" | 32 #include "url/gurl.h" |
33 | 33 |
34 using content::BrowserThread; | 34 using content::BrowserThread; |
35 using std::string; | 35 using std::string; |
36 | 36 |
| 37 using update_client::CrxComponent; |
| 38 using update_client::PartialMatch; |
| 39 using update_client::InterceptorFactory; |
| 40 using update_client::TestConfigurator; |
| 41 using update_client::TestInstaller; |
| 42 using update_client::URLRequestPostInterceptor; |
| 43 using update_client::VersionedTestInstaller; |
| 44 |
37 using ::testing::_; | 45 using ::testing::_; |
38 using ::testing::AnyNumber; | 46 using ::testing::AnyNumber; |
39 using ::testing::InSequence; | 47 using ::testing::InSequence; |
40 using ::testing::Mock; | 48 using ::testing::Mock; |
41 | 49 |
| 50 using update_client::abag_hash; |
| 51 using update_client::ihfo_hash; |
| 52 using update_client::jebg_hash; |
| 53 |
42 namespace component_updater { | 54 namespace component_updater { |
43 | 55 |
44 MockServiceObserver::MockServiceObserver() { | 56 MockServiceObserver::MockServiceObserver() { |
45 } | 57 } |
46 | 58 |
47 MockServiceObserver::~MockServiceObserver() { | 59 MockServiceObserver::~MockServiceObserver() { |
48 } | 60 } |
49 | 61 |
50 ComponentUpdaterTest::ComponentUpdaterTest() | 62 ComponentUpdaterTest::ComponentUpdaterTest() |
51 : post_interceptor_(NULL), | 63 : post_interceptor_(NULL), |
(...skipping 30 matching lines...) Expand all Loading... |
82 } | 94 } |
83 | 95 |
84 ComponentUpdateService* ComponentUpdaterTest::component_updater() { | 96 ComponentUpdateService* ComponentUpdaterTest::component_updater() { |
85 return component_updater_.get(); | 97 return component_updater_.get(); |
86 } | 98 } |
87 | 99 |
88 // Makes the full path to a component updater test file. | 100 // Makes the full path to a component updater test file. |
89 const base::FilePath ComponentUpdaterTest::test_file(const char* file) { | 101 const base::FilePath ComponentUpdaterTest::test_file(const char* file) { |
90 base::FilePath path; | 102 base::FilePath path; |
91 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 103 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
92 return path.AppendASCII("components").AppendASCII("test").AppendASCII("data") | 104 return path.AppendASCII("components") |
93 .AppendASCII("component_updater").AppendASCII(file); | 105 .AppendASCII("test") |
| 106 .AppendASCII("data") |
| 107 .AppendASCII("update_client") |
| 108 .AppendASCII(file); |
94 } | 109 } |
95 | 110 |
96 TestConfigurator* ComponentUpdaterTest::test_configurator() { | 111 TestConfigurator* ComponentUpdaterTest::test_configurator() { |
97 return test_config_; | 112 return test_config_; |
98 } | 113 } |
99 | 114 |
100 ComponentUpdateService::Status ComponentUpdaterTest::RegisterComponent( | 115 ComponentUpdateService::Status ComponentUpdaterTest::RegisterComponent( |
101 CrxComponent* com, | 116 CrxComponent* com, |
102 TestComponents component, | 117 TestComponents component, |
103 const Version& version, | 118 const Version& version, |
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 component_updater()->RemoveObserver(&observer2); | 1505 component_updater()->RemoveObserver(&observer2); |
1491 | 1506 |
1492 test_configurator()->SetLoopCount(1); | 1507 test_configurator()->SetLoopCount(1); |
1493 component_updater()->Start(); | 1508 component_updater()->Start(); |
1494 RunThreads(); | 1509 RunThreads(); |
1495 | 1510 |
1496 component_updater()->Stop(); | 1511 component_updater()->Stop(); |
1497 } | 1512 } |
1498 | 1513 |
1499 } // namespace component_updater | 1514 } // namespace component_updater |
OLD | NEW |