OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/json/json_reader.h" | 6 #include "base/json/json_reader.h" |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/thread_task_runner_handle.h" |
9 #include "chrome/browser/local_discovery/privet_http_impl.h" | 10 #include "chrome/browser/local_discovery/privet_http_impl.h" |
10 #include "net/base/host_port_pair.h" | 11 #include "net/base/host_port_pair.h" |
11 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
12 #include "net/url_request/test_url_fetcher_factory.h" | 13 #include "net/url_request/test_url_fetcher_factory.h" |
13 #include "net/url_request/url_request_test_util.h" | 14 #include "net/url_request/url_request_test_util.h" |
14 #include "printing/pwg_raster_settings.h" | 15 #include "printing/pwg_raster_settings.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 #if defined(ENABLE_PRINT_PREVIEW) | 19 #if defined(ENABLE_PRINT_PREVIEW) |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 238 |
238 // Callback issued correspondingly to the destructor. | 239 // Callback issued correspondingly to the destructor. |
239 MOCK_METHOD1(OnRequestEnd, void(int fetcher_id)); | 240 MOCK_METHOD1(OnRequestEnd, void(int fetcher_id)); |
240 }; | 241 }; |
241 | 242 |
242 class PrivetHTTPTest : public ::testing::Test { | 243 class PrivetHTTPTest : public ::testing::Test { |
243 public: | 244 public: |
244 PrivetHTTPTest() { | 245 PrivetHTTPTest() { |
245 PrivetURLFetcher::ResetTokenMapForTests(); | 246 PrivetURLFetcher::ResetTokenMapForTests(); |
246 | 247 |
247 request_context_= new net::TestURLRequestContextGetter( | 248 request_context_ = new net::TestURLRequestContextGetter( |
248 base::MessageLoopProxy::current()); | 249 base::ThreadTaskRunnerHandle::Get()); |
249 privet_client_ = | 250 privet_client_ = |
250 PrivetV1HTTPClient::CreateDefault(make_scoped_ptr<PrivetHTTPClient>( | 251 PrivetV1HTTPClient::CreateDefault(make_scoped_ptr<PrivetHTTPClient>( |
251 new PrivetHTTPClientImpl("sampleDevice._privet._tcp.local", | 252 new PrivetHTTPClientImpl("sampleDevice._privet._tcp.local", |
252 net::HostPortPair("10.0.0.8", 6006), | 253 net::HostPortPair("10.0.0.8", 6006), |
253 request_context_.get()))); | 254 request_context_.get()))); |
254 fetcher_factory_.SetDelegateForTests(&fetcher_delegate_); | 255 fetcher_factory_.SetDelegateForTests(&fetcher_delegate_); |
255 } | 256 } |
256 | 257 |
257 virtual ~PrivetHTTPTest() { | 258 virtual ~PrivetHTTPTest() { |
258 } | 259 } |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 | 1073 |
1073 EXPECT_TRUE(SuccessfulResponseToURL( | 1074 EXPECT_TRUE(SuccessfulResponseToURL( |
1074 GURL("http://10.0.0.8:6006/privet/printer/createjob"), | 1075 GURL("http://10.0.0.8:6006/privet/printer/createjob"), |
1075 kSampleCreatejobResponse)); | 1076 kSampleCreatejobResponse)); |
1076 } | 1077 } |
1077 #endif // ENABLE_PRINT_PREVIEW | 1078 #endif // ENABLE_PRINT_PREVIEW |
1078 | 1079 |
1079 } // namespace | 1080 } // namespace |
1080 | 1081 |
1081 } // namespace local_discovery | 1082 } // namespace local_discovery |
OLD | NEW |