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/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | |
10 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/thread_task_runner_handle.h" |
11 #include "components/update_client/request_sender.h" | 11 #include "components/update_client/request_sender.h" |
12 #include "components/update_client/test_configurator.h" | 12 #include "components/update_client/test_configurator.h" |
13 #include "components/update_client/url_request_post_interceptor.h" | 13 #include "components/update_client/url_request_post_interceptor.h" |
14 #include "net/url_request/url_fetcher.h" | 14 #include "net/url_request/url_fetcher.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 namespace update_client { | 17 namespace update_client { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 RequestSenderTest::RequestSenderTest() | 60 RequestSenderTest::RequestSenderTest() |
61 : post_interceptor_1(NULL), | 61 : post_interceptor_1(NULL), |
62 post_interceptor_2(NULL), | 62 post_interceptor_2(NULL), |
63 url_fetcher_source_(NULL) { | 63 url_fetcher_source_(NULL) { |
64 } | 64 } |
65 | 65 |
66 RequestSenderTest::~RequestSenderTest() { | 66 RequestSenderTest::~RequestSenderTest() { |
67 } | 67 } |
68 | 68 |
69 void RequestSenderTest::SetUp() { | 69 void RequestSenderTest::SetUp() { |
70 config_ = new TestConfigurator(base::MessageLoopProxy::current(), | 70 config_ = new TestConfigurator(base::ThreadTaskRunnerHandle::Get(), |
71 base::MessageLoopProxy::current()); | 71 base::ThreadTaskRunnerHandle::Get()); |
72 interceptor_factory_.reset( | 72 interceptor_factory_.reset( |
73 new InterceptorFactory(base::MessageLoopProxy::current())); | 73 new InterceptorFactory(base::ThreadTaskRunnerHandle::Get())); |
74 post_interceptor_1 = | 74 post_interceptor_1 = |
75 interceptor_factory_->CreateInterceptorForPath(kUrlPath1); | 75 interceptor_factory_->CreateInterceptorForPath(kUrlPath1); |
76 post_interceptor_2 = | 76 post_interceptor_2 = |
77 interceptor_factory_->CreateInterceptorForPath(kUrlPath2); | 77 interceptor_factory_->CreateInterceptorForPath(kUrlPath2); |
78 EXPECT_TRUE(post_interceptor_1); | 78 EXPECT_TRUE(post_interceptor_1); |
79 EXPECT_TRUE(post_interceptor_2); | 79 EXPECT_TRUE(post_interceptor_2); |
80 | 80 |
81 request_sender_.reset(); | 81 request_sender_.reset(); |
82 } | 82 } |
83 | 83 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 EXPECT_EQ(1, post_interceptor_2->GetCount()) | 197 EXPECT_EQ(1, post_interceptor_2->GetCount()) |
198 << post_interceptor_2->GetRequestsAsString(); | 198 << post_interceptor_2->GetRequestsAsString(); |
199 | 199 |
200 EXPECT_STREQ("test", post_interceptor_1->GetRequests()[0].c_str()); | 200 EXPECT_STREQ("test", post_interceptor_1->GetRequests()[0].c_str()); |
201 EXPECT_STREQ("test", post_interceptor_2->GetRequests()[0].c_str()); | 201 EXPECT_STREQ("test", post_interceptor_2->GetRequests()[0].c_str()); |
202 EXPECT_EQ(GURL(kUrl2), url_fetcher_source_->GetOriginalURL()); | 202 EXPECT_EQ(GURL(kUrl2), url_fetcher_source_->GetOriginalURL()); |
203 EXPECT_EQ(403, url_fetcher_source_->GetResponseCode()); | 203 EXPECT_EQ(403, url_fetcher_source_->GetResponseCode()); |
204 } | 204 } |
205 | 205 |
206 } // namespace update_client | 206 } // namespace update_client |
OLD | NEW |