| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/service/cloud_print/printer_job_handler.h" | 5 #include "chrome/service/cloud_print/printer_job_handler.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/md5.h" | 11 #include "base/md5.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 17 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| 18 #include "chrome/common/cloud_print/cloud_print_constants.h" | 18 #include "chrome/common/cloud_print/cloud_print_constants.h" |
| 19 #include "chrome/service/cloud_print/cloud_print_service_helpers.h" | 19 #include "chrome/service/cloud_print/cloud_print_service_helpers.h" |
| 20 #include "chrome/service/cloud_print/cloud_print_token_store.h" | 20 #include "chrome/service/cloud_print/cloud_print_token_store.h" |
| 21 #include "chrome/service/cloud_print/print_system.h" | 21 #include "chrome/service/cloud_print/print_system.h" |
| 22 #include "net/http/http_response_headers.h" | 22 #include "net/http/http_response_headers.h" |
| 23 #include "net/http/http_status_code.h" | 23 #include "net/http/http_status_code.h" |
| 24 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" |
| 24 #include "net/url_request/test_url_fetcher_factory.h" | 25 #include "net/url_request/test_url_fetcher_factory.h" |
| 25 #include "net/url_request/url_request_status.h" | 26 #include "net/url_request/url_request_status.h" |
| 26 #include "net/url_request/url_request_test_util.h" | 27 #include "net/url_request/url_request_test_util.h" |
| 27 #include "printing/backend/print_backend.h" | 28 #include "printing/backend/print_backend.h" |
| 28 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
| 29 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
| 30 | 31 |
| 31 using ::testing::AtLeast; | 32 using ::testing::AtLeast; |
| 32 using ::testing::DoAll; | 33 using ::testing::DoAll; |
| 33 using ::testing::Exactly; | 34 using ::testing::Exactly; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 job_num, | 247 job_num, |
| 247 status_string); | 248 status_string); |
| 248 } | 249 } |
| 249 | 250 |
| 250 } // namespace | 251 } // namespace |
| 251 | 252 |
| 252 class CloudPrintURLFetcherNoServiceProcess | 253 class CloudPrintURLFetcherNoServiceProcess |
| 253 : public CloudPrintURLFetcher { | 254 : public CloudPrintURLFetcher { |
| 254 public: | 255 public: |
| 255 CloudPrintURLFetcherNoServiceProcess() | 256 CloudPrintURLFetcherNoServiceProcess() |
| 256 : context_getter_(new net::TestURLRequestContextGetter( | 257 : CloudPrintURLFetcher(PARTIAL_TRAFFIC_ANNOTATION_FOR_TESTS), |
| 258 context_getter_(new net::TestURLRequestContextGetter( |
| 257 base::ThreadTaskRunnerHandle::Get())) {} | 259 base::ThreadTaskRunnerHandle::Get())) {} |
| 258 | 260 |
| 259 protected: | 261 protected: |
| 260 net::URLRequestContextGetter* GetRequestContextGetter() override { | 262 net::URLRequestContextGetter* GetRequestContextGetter() override { |
| 261 return context_getter_.get(); | 263 return context_getter_.get(); |
| 262 } | 264 } |
| 263 | 265 |
| 264 ~CloudPrintURLFetcherNoServiceProcess() override {} | 266 ~CloudPrintURLFetcherNoServiceProcess() override {} |
| 265 | 267 |
| 266 private: | 268 private: |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 .WillOnce(InvokeWithoutArgs( | 822 .WillOnce(InvokeWithoutArgs( |
| 821 this, &PrinterJobHandlerTest::MakeJobFetchReturnNoJobs)); | 823 this, &PrinterJobHandlerTest::MakeJobFetchReturnNoJobs)); |
| 822 | 824 |
| 823 EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(1), _)) | 825 EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(1), _)) |
| 824 .Times(AtLeast(kNumRetriesBeforeAbandonJob)); | 826 .Times(AtLeast(kNumRetriesBeforeAbandonJob)); |
| 825 | 827 |
| 826 BeginTest(70); | 828 BeginTest(70); |
| 827 } | 829 } |
| 828 | 830 |
| 829 } // namespace cloud_print | 831 } // namespace cloud_print |
| OLD | NEW |