| 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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/single_thread_task_runner.h" |
| 9 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 10 #include "chrome/browser/local_discovery/privet_http_impl.h" | 12 #include "chrome/browser/local_discovery/privet_http_impl.h" |
| 11 #include "net/base/host_port_pair.h" | 13 #include "net/base/host_port_pair.h" |
| 12 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 13 #include "net/url_request/test_url_fetcher_factory.h" | 15 #include "net/url_request/test_url_fetcher_factory.h" |
| 14 #include "net/url_request/url_request_test_util.h" | 16 #include "net/url_request/url_request_test_util.h" |
| 15 #include "printing/pwg_raster_settings.h" | 17 #include "printing/pwg_raster_settings.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 20 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 EXPECT_EQ(file_path, fetcher->upload_file_path()); | 323 EXPECT_EQ(file_path, fetcher->upload_file_path()); |
| 322 if (file_path != fetcher->upload_file_path()) return false; | 324 if (file_path != fetcher->upload_file_path()) return false; |
| 323 | 325 |
| 324 return SuccessfulResponseToURL(url, response); | 326 return SuccessfulResponseToURL(url, response); |
| 325 } | 327 } |
| 326 | 328 |
| 327 | 329 |
| 328 void RunFor(base::TimeDelta time_period) { | 330 void RunFor(base::TimeDelta time_period) { |
| 329 base::CancelableCallback<void()> callback(base::Bind( | 331 base::CancelableCallback<void()> callback(base::Bind( |
| 330 &PrivetHTTPTest::Stop, base::Unretained(this))); | 332 &PrivetHTTPTest::Stop, base::Unretained(this))); |
| 331 base::MessageLoop::current()->PostDelayedTask( | 333 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 332 FROM_HERE, callback.callback(), time_period); | 334 FROM_HERE, callback.callback(), time_period); |
| 333 | 335 |
| 334 base::MessageLoop::current()->Run(); | 336 base::MessageLoop::current()->Run(); |
| 335 callback.Cancel(); | 337 callback.Cancel(); |
| 336 } | 338 } |
| 337 | 339 |
| 338 void Stop() { | 340 void Stop() { |
| 339 base::MessageLoop::current()->Quit(); | 341 base::MessageLoop::current()->Quit(); |
| 340 } | 342 } |
| 341 | 343 |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 | 1075 |
| 1074 EXPECT_TRUE(SuccessfulResponseToURL( | 1076 EXPECT_TRUE(SuccessfulResponseToURL( |
| 1075 GURL("http://10.0.0.8:6006/privet/printer/createjob"), | 1077 GURL("http://10.0.0.8:6006/privet/printer/createjob"), |
| 1076 kSampleCreatejobResponse)); | 1078 kSampleCreatejobResponse)); |
| 1077 } | 1079 } |
| 1078 #endif // ENABLE_PRINT_PREVIEW | 1080 #endif // ENABLE_PRINT_PREVIEW |
| 1079 | 1081 |
| 1080 } // namespace | 1082 } // namespace |
| 1081 | 1083 |
| 1082 } // namespace local_discovery | 1084 } // namespace local_discovery |
| OLD | NEW |