OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop/message_loop.h" | |
13 #include "base/path_service.h" | 12 #include "base/path_service.h" |
14 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/thread_task_runner_handle.h" |
15 #include "base/version.h" | 15 #include "base/version.h" |
16 #include "components/update_client/crx_update_item.h" | 16 #include "components/update_client/crx_update_item.h" |
17 #include "components/update_client/test_configurator.h" | 17 #include "components/update_client/test_configurator.h" |
18 #include "components/update_client/update_checker.h" | 18 #include "components/update_client/update_checker.h" |
19 #include "components/update_client/url_request_post_interceptor.h" | 19 #include "components/update_client/url_request_post_interceptor.h" |
20 #include "net/url_request/url_request_test_util.h" | 20 #include "net/url_request/url_request_test_util.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
23 | 23 |
24 using std::string; | 24 using std::string; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 DISALLOW_COPY_AND_ASSIGN(UpdateCheckerTest); | 79 DISALLOW_COPY_AND_ASSIGN(UpdateCheckerTest); |
80 }; | 80 }; |
81 | 81 |
82 UpdateCheckerTest::UpdateCheckerTest() : post_interceptor_(NULL), error_(0) { | 82 UpdateCheckerTest::UpdateCheckerTest() : post_interceptor_(NULL), error_(0) { |
83 } | 83 } |
84 | 84 |
85 UpdateCheckerTest::~UpdateCheckerTest() { | 85 UpdateCheckerTest::~UpdateCheckerTest() { |
86 } | 86 } |
87 | 87 |
88 void UpdateCheckerTest::SetUp() { | 88 void UpdateCheckerTest::SetUp() { |
89 config_ = new TestConfigurator(base::MessageLoopProxy::current(), | 89 config_ = new TestConfigurator(base::ThreadTaskRunnerHandle::Get(), |
90 base::MessageLoopProxy::current()); | 90 base::ThreadTaskRunnerHandle::Get()); |
91 interceptor_factory_.reset( | 91 interceptor_factory_.reset( |
92 new InterceptorFactory(base::MessageLoopProxy::current())); | 92 new InterceptorFactory(base::ThreadTaskRunnerHandle::Get())); |
93 post_interceptor_ = interceptor_factory_->CreateInterceptor(); | 93 post_interceptor_ = interceptor_factory_->CreateInterceptor(); |
94 EXPECT_TRUE(post_interceptor_); | 94 EXPECT_TRUE(post_interceptor_); |
95 | 95 |
96 update_checker_.reset(); | 96 update_checker_.reset(); |
97 | 97 |
98 error_ = 0; | 98 error_ = 0; |
99 error_message_.clear(); | 99 error_message_.clear(); |
100 results_ = UpdateResponse::Results(); | 100 results_ = UpdateResponse::Results(); |
101 } | 101 } |
102 | 102 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 EXPECT_EQ(1, post_interceptor_->GetCount()) | 228 EXPECT_EQ(1, post_interceptor_->GetCount()) |
229 << post_interceptor_->GetRequestsAsString(); | 229 << post_interceptor_->GetRequestsAsString(); |
230 | 230 |
231 EXPECT_EQ(config_->UpdateUrl().front(), original_url_); | 231 EXPECT_EQ(config_->UpdateUrl().front(), original_url_); |
232 EXPECT_EQ(403, error_); | 232 EXPECT_EQ(403, error_); |
233 EXPECT_STREQ("network error", error_message_.c_str()); | 233 EXPECT_STREQ("network error", error_message_.c_str()); |
234 EXPECT_EQ(0ul, results_.list.size()); | 234 EXPECT_EQ(0ul, results_.list.size()); |
235 } | 235 } |
236 | 236 |
237 } // namespace update_client | 237 } // namespace update_client |
OLD | NEW |