| 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/location.h" | 8 #include "base/location.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 void RunFor(base::TimeDelta time_period) { | 330 void RunFor(base::TimeDelta time_period) { |
| 331 base::CancelableCallback<void()> callback(base::Bind( | 331 base::CancelableCallback<void()> callback(base::Bind( |
| 332 &PrivetHTTPTest::Stop, base::Unretained(this))); | 332 &PrivetHTTPTest::Stop, base::Unretained(this))); |
| 333 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 333 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 334 FROM_HERE, callback.callback(), time_period); | 334 FROM_HERE, callback.callback(), time_period); |
| 335 | 335 |
| 336 base::MessageLoop::current()->Run(); | 336 base::MessageLoop::current()->Run(); |
| 337 callback.Cancel(); | 337 callback.Cancel(); |
| 338 } | 338 } |
| 339 | 339 |
| 340 void Stop() { | 340 void Stop() { base::MessageLoop::current()->QuitWhenIdle(); } |
| 341 base::MessageLoop::current()->Quit(); | |
| 342 } | |
| 343 | 341 |
| 344 protected: | 342 protected: |
| 345 base::MessageLoop loop_; | 343 base::MessageLoop loop_; |
| 346 scoped_refptr<net::TestURLRequestContextGetter> request_context_; | 344 scoped_refptr<net::TestURLRequestContextGetter> request_context_; |
| 347 net::TestURLFetcherFactory fetcher_factory_; | 345 net::TestURLFetcherFactory fetcher_factory_; |
| 348 scoped_ptr<PrivetV1HTTPClient> privet_client_; | 346 scoped_ptr<PrivetV1HTTPClient> privet_client_; |
| 349 NiceMock<MockTestURLFetcherFactoryDelegate> fetcher_delegate_; | 347 NiceMock<MockTestURLFetcherFactoryDelegate> fetcher_delegate_; |
| 350 }; | 348 }; |
| 351 | 349 |
| 352 class MockJSONCallback{ | 350 class MockJSONCallback{ |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 | 1073 |
| 1076 EXPECT_TRUE(SuccessfulResponseToURL( | 1074 EXPECT_TRUE(SuccessfulResponseToURL( |
| 1077 GURL("http://10.0.0.8:6006/privet/printer/createjob"), | 1075 GURL("http://10.0.0.8:6006/privet/printer/createjob"), |
| 1078 kSampleCreatejobResponse)); | 1076 kSampleCreatejobResponse)); |
| 1079 } | 1077 } |
| 1080 #endif // ENABLE_PRINT_PREVIEW | 1078 #endif // ENABLE_PRINT_PREVIEW |
| 1081 | 1079 |
| 1082 } // namespace | 1080 } // namespace |
| 1083 | 1081 |
| 1084 } // namespace local_discovery | 1082 } // namespace local_discovery |
| OLD | NEW |