| 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 "chrome/browser/printing/cloud_print/privet_http.h" | 5 #include "chrome/browser/printing/cloud_print/privet_http.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 return SuccessfulResponseToURL(url, response); | 342 return SuccessfulResponseToURL(url, response); |
| 343 } | 343 } |
| 344 | 344 |
| 345 | 345 |
| 346 void RunFor(base::TimeDelta time_period) { | 346 void RunFor(base::TimeDelta time_period) { |
| 347 base::CancelableCallback<void()> callback(base::Bind( | 347 base::CancelableCallback<void()> callback(base::Bind( |
| 348 &PrivetHTTPTest::Stop, base::Unretained(this))); | 348 &PrivetHTTPTest::Stop, base::Unretained(this))); |
| 349 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 349 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 350 FROM_HERE, callback.callback(), time_period); | 350 FROM_HERE, callback.callback(), time_period); |
| 351 | 351 |
| 352 base::MessageLoop::current()->Run(); | 352 base::RunLoop().Run(); |
| 353 callback.Cancel(); | 353 callback.Cancel(); |
| 354 } | 354 } |
| 355 | 355 |
| 356 void Stop() { base::MessageLoop::current()->QuitWhenIdle(); } | 356 void Stop() { base::MessageLoop::current()->QuitWhenIdle(); } |
| 357 | 357 |
| 358 protected: | 358 protected: |
| 359 base::MessageLoop loop_; | 359 base::MessageLoop loop_; |
| 360 scoped_refptr<net::TestURLRequestContextGetter> request_context_; | 360 scoped_refptr<net::TestURLRequestContextGetter> request_context_; |
| 361 net::TestURLFetcherFactory fetcher_factory_; | 361 net::TestURLFetcherFactory fetcher_factory_; |
| 362 std::unique_ptr<PrivetV1HTTPClient> privet_client_; | 362 std::unique_ptr<PrivetV1HTTPClient> privet_client_; |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1116 base::Closure quit_; | 1116 base::Closure quit_; |
| 1117 }; | 1117 }; |
| 1118 | 1118 |
| 1119 TEST_F(PrivetHttpWithServerTest, HttpServer) { | 1119 TEST_F(PrivetHttpWithServerTest, HttpServer) { |
| 1120 EXPECT_TRUE(Run()); | 1120 EXPECT_TRUE(Run()); |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 } // namespace | 1123 } // namespace |
| 1124 | 1124 |
| 1125 } // namespace cloud_print | 1125 } // namespace cloud_print |
| OLD | NEW |