| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/location.h" | 6 #include "base/location.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 base::MessageLoop::QuitWhenIdleClosure()); | 328 base::MessageLoop::QuitWhenIdleClosure()); |
| 329 } | 329 } |
| 330 | 330 |
| 331 TEST_F(CloudPrintURLFetcherBasicTest, HandleRawResponse) { | 331 TEST_F(CloudPrintURLFetcherBasicTest, HandleRawResponse) { |
| 332 net::EmbeddedTestServer test_server; | 332 net::EmbeddedTestServer test_server; |
| 333 test_server.AddDefaultHandlers(base::FilePath(kDocRoot)); | 333 test_server.AddDefaultHandlers(base::FilePath(kDocRoot)); |
| 334 ASSERT_TRUE(test_server.Start()); | 334 ASSERT_TRUE(test_server.Start()); |
| 335 SetHandleRawResponse(true); | 335 SetHandleRawResponse(true); |
| 336 | 336 |
| 337 CreateFetcher(test_server.GetURL("/echo"), 0); | 337 CreateFetcher(test_server.GetURL("/echo"), 0); |
| 338 base::MessageLoop::current()->Run(); | 338 base::RunLoop().Run(); |
| 339 } | 339 } |
| 340 | 340 |
| 341 TEST_F(CloudPrintURLFetcherBasicTest, HandleRawData) { | 341 TEST_F(CloudPrintURLFetcherBasicTest, HandleRawData) { |
| 342 net::EmbeddedTestServer test_server; | 342 net::EmbeddedTestServer test_server; |
| 343 test_server.AddDefaultHandlers(base::FilePath(kDocRoot)); | 343 test_server.AddDefaultHandlers(base::FilePath(kDocRoot)); |
| 344 ASSERT_TRUE(test_server.Start()); | 344 ASSERT_TRUE(test_server.Start()); |
| 345 | 345 |
| 346 SetHandleRawData(true); | 346 SetHandleRawData(true); |
| 347 CreateFetcher(test_server.GetURL("/echo"), 0); | 347 CreateFetcher(test_server.GetURL("/echo"), 0); |
| 348 base::MessageLoop::current()->Run(); | 348 base::RunLoop().Run(); |
| 349 } | 349 } |
| 350 | 350 |
| 351 TEST_F(CloudPrintURLFetcherOverloadTest, Protect) { | 351 TEST_F(CloudPrintURLFetcherOverloadTest, Protect) { |
| 352 net::EmbeddedTestServer test_server; | 352 net::EmbeddedTestServer test_server; |
| 353 test_server.AddDefaultHandlers(base::FilePath(kDocRoot)); | 353 test_server.AddDefaultHandlers(base::FilePath(kDocRoot)); |
| 354 ASSERT_TRUE(test_server.Start()); | 354 ASSERT_TRUE(test_server.Start()); |
| 355 | 355 |
| 356 GURL url(test_server.GetURL("/defaultresponse")); | 356 GURL url(test_server.GetURL("/defaultresponse")); |
| 357 CreateFetcher(url, 11); | 357 CreateFetcher(url, 11); |
| 358 | 358 |
| 359 base::MessageLoop::current()->Run(); | 359 base::RunLoop().Run(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 TEST_F(CloudPrintURLFetcherRetryBackoffTest, GiveUp) { | 362 TEST_F(CloudPrintURLFetcherRetryBackoffTest, GiveUp) { |
| 363 net::EmbeddedTestServer test_server; | 363 net::EmbeddedTestServer test_server; |
| 364 test_server.AddDefaultHandlers(base::FilePath(kDocRoot)); | 364 test_server.AddDefaultHandlers(base::FilePath(kDocRoot)); |
| 365 ASSERT_TRUE(test_server.Start()); | 365 ASSERT_TRUE(test_server.Start()); |
| 366 | 366 |
| 367 GURL url(test_server.GetURL("/defaultresponse")); | 367 GURL url(test_server.GetURL("/defaultresponse")); |
| 368 CreateFetcher(url, 11); | 368 CreateFetcher(url, 11); |
| 369 | 369 |
| 370 base::MessageLoop::current()->Run(); | 370 base::RunLoop().Run(); |
| 371 } | 371 } |
| 372 | 372 |
| 373 } // namespace cloud_print | 373 } // namespace cloud_print |
| OLD | NEW |