| 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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/md5.h" | 6 #include "base/md5.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "chrome/common/cloud_print/cloud_print_constants.h" | 12 #include "chrome/common/cloud_print/cloud_print_constants.h" |
| 13 #include "chrome/service/cloud_print/cloud_print_service_helpers.h" | 13 #include "chrome/service/cloud_print/cloud_print_service_helpers.h" |
| 14 #include "chrome/service/cloud_print/cloud_print_token_store.h" | 14 #include "chrome/service/cloud_print/cloud_print_token_store.h" |
| 15 #include "chrome/service/cloud_print/print_system.h" | 15 #include "chrome/service/cloud_print/print_system.h" |
| 16 #include "chrome/service/cloud_print/printer_job_handler.h" | 16 #include "chrome/service/cloud_print/printer_job_handler.h" |
| 17 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
| 18 #include "net/http/http_status_code.h" | 18 #include "net/http/http_status_code.h" |
| 19 #include "net/url_request/test_url_fetcher_factory.h" | 19 #include "net/url_request/test_url_fetcher_factory.h" |
| 20 #include "net/url_request/url_request_status.h" |
| 20 #include "net/url_request/url_request_test_util.h" | 21 #include "net/url_request/url_request_test_util.h" |
| 21 #include "printing/backend/print_backend.h" | 22 #include "printing/backend/print_backend.h" |
| 22 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 25 |
| 25 using ::testing::AtLeast; | 26 using ::testing::AtLeast; |
| 26 using ::testing::DoAll; | 27 using ::testing::DoAll; |
| 27 using ::testing::Exactly; | 28 using ::testing::Exactly; |
| 28 using ::testing::Invoke; | 29 using ::testing::Invoke; |
| 29 using ::testing::InvokeWithoutArgs; | 30 using ::testing::InvokeWithoutArgs; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 // This class handles the callback from FakeURLFetcher | 276 // This class handles the callback from FakeURLFetcher |
| 276 // It is a separate class because callback methods must be | 277 // It is a separate class because callback methods must be |
| 277 // on RefCounted classes | 278 // on RefCounted classes |
| 278 | 279 |
| 279 class TestURLFetcherCallback { | 280 class TestURLFetcherCallback { |
| 280 public: | 281 public: |
| 281 scoped_ptr<net::FakeURLFetcher> CreateURLFetcher( | 282 scoped_ptr<net::FakeURLFetcher> CreateURLFetcher( |
| 282 const GURL& url, | 283 const GURL& url, |
| 283 net::URLFetcherDelegate* d, | 284 net::URLFetcherDelegate* d, |
| 284 const std::string& response_data, | 285 const std::string& response_data, |
| 285 net::HttpStatusCode response_code) { | 286 net::HttpStatusCode response_code, |
| 287 net::URLRequestStatus::Status status) { |
| 286 scoped_ptr<net::FakeURLFetcher> fetcher( | 288 scoped_ptr<net::FakeURLFetcher> fetcher( |
| 287 new net::FakeURLFetcher(url, d, response_data, response_code)); | 289 new net::FakeURLFetcher(url, d, response_data, response_code, status)); |
| 288 OnRequestCreate(url, fetcher.get()); | 290 OnRequestCreate(url, fetcher.get()); |
| 289 return fetcher.Pass(); | 291 return fetcher.Pass(); |
| 290 } | 292 } |
| 291 MOCK_METHOD2(OnRequestCreate, | 293 MOCK_METHOD2(OnRequestCreate, |
| 292 void(const GURL&, net::FakeURLFetcher*)); | 294 void(const GURL&, net::FakeURLFetcher*)); |
| 293 }; | 295 }; |
| 294 | 296 |
| 295 | 297 |
| 296 class MockPrinterJobHandlerDelegate | 298 class MockPrinterJobHandlerDelegate |
| 297 : public PrinterJobHandler::Delegate { | 299 : public PrinterJobHandler::Delegate { |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 .WillByDefault(Invoke(this, &PrinterJobHandlerTest::GetPrinterInfo)); | 493 .WillByDefault(Invoke(this, &PrinterJobHandlerTest::GetPrinterInfo)); |
| 492 | 494 |
| 493 ON_CALL(*print_system_.get(), GetPrinterCapsAndDefaults(_, _)) | 495 ON_CALL(*print_system_.get(), GetPrinterCapsAndDefaults(_, _)) |
| 494 .WillByDefault(Invoke(this, &PrinterJobHandlerTest::SendCapsAndDefaults)); | 496 .WillByDefault(Invoke(this, &PrinterJobHandlerTest::SendCapsAndDefaults)); |
| 495 | 497 |
| 496 CloudPrintURLFetcher::set_factory(&cloud_print_factory_); | 498 CloudPrintURLFetcher::set_factory(&cloud_print_factory_); |
| 497 } | 499 } |
| 498 | 500 |
| 499 void PrinterJobHandlerTest::MakeJobFetchReturnNoJobs() { | 501 void PrinterJobHandlerTest::MakeJobFetchReturnNoJobs() { |
| 500 factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup), | 502 factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup), |
| 501 JobListResponse(0), net::HTTP_OK); | 503 JobListResponse(0), net::HTTP_OK, |
| 504 net::URLRequestStatus::SUCCESS); |
| 502 factory_.SetFakeResponse(JobListURI(kJobFetchReasonFailure), | 505 factory_.SetFakeResponse(JobListURI(kJobFetchReasonFailure), |
| 503 JobListResponse(0), net::HTTP_OK); | 506 JobListResponse(0), net::HTTP_OK, |
| 507 net::URLRequestStatus::SUCCESS); |
| 504 factory_.SetFakeResponse(JobListURI(kJobFetchReasonRetry), | 508 factory_.SetFakeResponse(JobListURI(kJobFetchReasonRetry), |
| 505 JobListResponse(0), net::HTTP_OK); | 509 JobListResponse(0), net::HTTP_OK, |
| 510 net::URLRequestStatus::SUCCESS); |
| 506 } | 511 } |
| 507 | 512 |
| 508 void PrinterJobHandlerTest::MessageLoopQuitNowHelper( | 513 void PrinterJobHandlerTest::MessageLoopQuitNowHelper( |
| 509 base::MessageLoop* message_loop) { | 514 base::MessageLoop* message_loop) { |
| 510 message_loop->QuitWhenIdle(); | 515 message_loop->QuitWhenIdle(); |
| 511 } | 516 } |
| 512 | 517 |
| 513 void PrinterJobHandlerTest::MessageLoopQuitSoonHelper( | 518 void PrinterJobHandlerTest::MessageLoopQuitSoonHelper( |
| 514 base::MessageLoop* message_loop) { | 519 base::MessageLoop* message_loop) { |
| 515 message_loop->message_loop_proxy()->PostTask( | 520 message_loop->message_loop_proxy()->PostTask( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 537 void PrinterJobHandlerTest::AddMimeHeader(const GURL& url, | 542 void PrinterJobHandlerTest::AddMimeHeader(const GURL& url, |
| 538 net::FakeURLFetcher* fetcher) { | 543 net::FakeURLFetcher* fetcher) { |
| 539 scoped_refptr<net::HttpResponseHeaders> download_headers = | 544 scoped_refptr<net::HttpResponseHeaders> download_headers = |
| 540 new net::HttpResponseHeaders(kExampleJobDownloadResponseHeaders); | 545 new net::HttpResponseHeaders(kExampleJobDownloadResponseHeaders); |
| 541 fetcher->set_response_headers(download_headers); | 546 fetcher->set_response_headers(download_headers); |
| 542 } | 547 } |
| 543 | 548 |
| 544 | 549 |
| 545 void PrinterJobHandlerTest::SetUpJobSuccessTest(int job_num) { | 550 void PrinterJobHandlerTest::SetUpJobSuccessTest(int job_num) { |
| 546 factory_.SetFakeResponse(TicketURI(job_num), | 551 factory_.SetFakeResponse(TicketURI(job_num), |
| 547 kExamplePrintTicket, net::HTTP_OK); | 552 kExamplePrintTicket, net::HTTP_OK, |
| 553 net::URLRequestStatus::SUCCESS); |
| 548 factory_.SetFakeResponse(DownloadURI(job_num), | 554 factory_.SetFakeResponse(DownloadURI(job_num), |
| 549 kExamplePrintData, net::HTTP_OK); | 555 kExamplePrintData, net::HTTP_OK, |
| 556 net::URLRequestStatus::SUCCESS); |
| 550 | 557 |
| 551 factory_.SetFakeResponse(DoneURI(job_num), | 558 factory_.SetFakeResponse(DoneURI(job_num), |
| 552 StatusResponse(job_num, "DONE"), | 559 StatusResponse(job_num, "DONE"), |
| 553 net::HTTP_OK); | 560 net::HTTP_OK, |
| 561 net::URLRequestStatus::SUCCESS); |
| 554 factory_.SetFakeResponse(InProgressURI(job_num), | 562 factory_.SetFakeResponse(InProgressURI(job_num), |
| 555 StatusResponse(job_num, "IN_PROGRESS"), | 563 StatusResponse(job_num, "IN_PROGRESS"), |
| 556 net::HTTP_OK); | 564 net::HTTP_OK, |
| 565 net::URLRequestStatus::SUCCESS); |
| 557 | 566 |
| 558 // The times requirement is relaxed for the ticket URI | 567 // The times requirement is relaxed for the ticket URI |
| 559 // in order to accommodate TicketDownloadFailureTest | 568 // in order to accommodate TicketDownloadFailureTest |
| 560 EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(job_num), _)) | 569 EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(job_num), _)) |
| 561 .Times(AtLeast(1)); | 570 .Times(AtLeast(1)); |
| 562 | 571 |
| 563 EXPECT_CALL(url_callback_, OnRequestCreate(DownloadURI(job_num), _)) | 572 EXPECT_CALL(url_callback_, OnRequestCreate(DownloadURI(job_num), _)) |
| 564 .Times(Exactly(1)) | 573 .Times(Exactly(1)) |
| 565 .WillOnce(Invoke(this, &PrinterJobHandlerTest::AddMimeHeader)); | 574 .WillOnce(Invoke(this, &PrinterJobHandlerTest::AddMimeHeader)); |
| 566 | 575 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 | 659 |
| 651 ON_CALL(*this, ValidatePrintTicket(_, _)). | 660 ON_CALL(*this, ValidatePrintTicket(_, _)). |
| 652 WillByDefault(Return(true)); | 661 WillByDefault(Return(true)); |
| 653 }; | 662 }; |
| 654 | 663 |
| 655 // This test simulates an end-to-end printing of a document | 664 // This test simulates an end-to-end printing of a document |
| 656 // but tests only non-failure cases. | 665 // but tests only non-failure cases. |
| 657 // Disabled - http://crbug.com/184245 | 666 // Disabled - http://crbug.com/184245 |
| 658 TEST_F(PrinterJobHandlerTest, DISABLED_HappyPathTest) { | 667 TEST_F(PrinterJobHandlerTest, DISABLED_HappyPathTest) { |
| 659 factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup), | 668 factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup), |
| 660 JobListResponse(1), net::HTTP_OK); | 669 JobListResponse(1), net::HTTP_OK, |
| 670 net::URLRequestStatus::SUCCESS); |
| 661 factory_.SetFakeResponse(JobListURI(kJobFetchReasonQueryMore), | 671 factory_.SetFakeResponse(JobListURI(kJobFetchReasonQueryMore), |
| 662 JobListResponse(0), net::HTTP_OK); | 672 JobListResponse(0), net::HTTP_OK, |
| 673 net::URLRequestStatus::SUCCESS); |
| 663 | 674 |
| 664 EXPECT_CALL(url_callback_, | 675 EXPECT_CALL(url_callback_, |
| 665 OnRequestCreate(JobListURI(kJobFetchReasonStartup), _)) | 676 OnRequestCreate(JobListURI(kJobFetchReasonStartup), _)) |
| 666 .Times(Exactly(1)); | 677 .Times(Exactly(1)); |
| 667 EXPECT_CALL(url_callback_, | 678 EXPECT_CALL(url_callback_, |
| 668 OnRequestCreate(JobListURI(kJobFetchReasonQueryMore), _)) | 679 OnRequestCreate(JobListURI(kJobFetchReasonQueryMore), _)) |
| 669 .Times(Exactly(1)); | 680 .Times(Exactly(1)); |
| 670 | 681 |
| 671 SetUpJobSuccessTest(1); | 682 SetUpJobSuccessTest(1); |
| 672 BeginTest(20); | 683 BeginTest(20); |
| 673 } | 684 } |
| 674 | 685 |
| 675 TEST_F(PrinterJobHandlerTest, TicketDownloadFailureTest) { | 686 TEST_F(PrinterJobHandlerTest, TicketDownloadFailureTest) { |
| 676 factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup), | 687 factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup), |
| 677 JobListResponse(2), net::HTTP_OK); | 688 JobListResponse(2), net::HTTP_OK, |
| 689 net::URLRequestStatus::SUCCESS); |
| 678 factory_.SetFakeResponse(JobListURI(kJobFetchReasonFailure), | 690 factory_.SetFakeResponse(JobListURI(kJobFetchReasonFailure), |
| 679 JobListResponse(2), net::HTTP_OK); | 691 JobListResponse(2), net::HTTP_OK, |
| 692 net::URLRequestStatus::SUCCESS); |
| 680 factory_.SetFakeResponse(JobListURI(kJobFetchReasonQueryMore), | 693 factory_.SetFakeResponse(JobListURI(kJobFetchReasonQueryMore), |
| 681 JobListResponse(0), net::HTTP_OK); | 694 JobListResponse(0), net::HTTP_OK, |
| 695 net::URLRequestStatus::SUCCESS); |
| 682 factory_.SetFakeResponse(TicketURI(1), std::string(), | 696 factory_.SetFakeResponse(TicketURI(1), std::string(), |
| 683 net::HTTP_INTERNAL_SERVER_ERROR); | 697 net::HTTP_INTERNAL_SERVER_ERROR, |
| 698 net::URLRequestStatus::FAILED); |
| 684 | 699 |
| 685 EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(1), _)) | 700 EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(1), _)) |
| 686 .Times(AtLeast(1)); | 701 .Times(AtLeast(1)); |
| 687 | 702 |
| 688 EXPECT_CALL(url_callback_, | 703 EXPECT_CALL(url_callback_, |
| 689 OnRequestCreate(JobListURI(kJobFetchReasonStartup), _)) | 704 OnRequestCreate(JobListURI(kJobFetchReasonStartup), _)) |
| 690 .Times(AtLeast(1)); | 705 .Times(AtLeast(1)); |
| 691 | 706 |
| 692 EXPECT_CALL(url_callback_, | 707 EXPECT_CALL(url_callback_, |
| 693 OnRequestCreate(JobListURI(kJobFetchReasonQueryMore), _)) | 708 OnRequestCreate(JobListURI(kJobFetchReasonQueryMore), _)) |
| 694 .Times(AtLeast(1)); | 709 .Times(AtLeast(1)); |
| 695 | 710 |
| 696 EXPECT_CALL(url_callback_, | 711 EXPECT_CALL(url_callback_, |
| 697 OnRequestCreate(JobListURI(kJobFetchReasonFailure), _)) | 712 OnRequestCreate(JobListURI(kJobFetchReasonFailure), _)) |
| 698 .Times(AtLeast(1)); | 713 .Times(AtLeast(1)); |
| 699 | 714 |
| 700 SetUpJobSuccessTest(2); | 715 SetUpJobSuccessTest(2); |
| 701 BeginTest(20); | 716 BeginTest(20); |
| 702 } | 717 } |
| 703 | 718 |
| 704 // TODO(noamsml): Figure out how to make this test not take 1 second and | 719 // TODO(noamsml): Figure out how to make this test not take 1 second and |
| 705 // re-enable it | 720 // re-enable it |
| 706 TEST_F(PrinterJobHandlerTest, DISABLED_ManyFailureTest) { | 721 TEST_F(PrinterJobHandlerTest, DISABLED_ManyFailureTest) { |
| 707 factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup), | 722 factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup), |
| 708 JobListResponse(1), net::HTTP_OK); | 723 JobListResponse(1), net::HTTP_OK, |
| 724 net::URLRequestStatus::SUCCESS); |
| 709 factory_.SetFakeResponse(JobListURI(kJobFetchReasonFailure), | 725 factory_.SetFakeResponse(JobListURI(kJobFetchReasonFailure), |
| 710 JobListResponse(1), net::HTTP_OK); | 726 JobListResponse(1), net::HTTP_OK, |
| 727 net::URLRequestStatus::SUCCESS); |
| 711 factory_.SetFakeResponse(JobListURI(kJobFetchReasonRetry), | 728 factory_.SetFakeResponse(JobListURI(kJobFetchReasonRetry), |
| 712 JobListResponse(1), net::HTTP_OK); | 729 JobListResponse(1), net::HTTP_OK, |
| 730 net::URLRequestStatus::SUCCESS); |
| 713 factory_.SetFakeResponse(JobListURI(kJobFetchReasonQueryMore), | 731 factory_.SetFakeResponse(JobListURI(kJobFetchReasonQueryMore), |
| 714 JobListResponse(0), net::HTTP_OK); | 732 JobListResponse(0), net::HTTP_OK, |
| 733 net::URLRequestStatus::SUCCESS); |
| 715 | 734 |
| 716 EXPECT_CALL(url_callback_, | 735 EXPECT_CALL(url_callback_, |
| 717 OnRequestCreate(JobListURI(kJobFetchReasonStartup), _)) | 736 OnRequestCreate(JobListURI(kJobFetchReasonStartup), _)) |
| 718 .Times(AtLeast(1)); | 737 .Times(AtLeast(1)); |
| 719 | 738 |
| 720 EXPECT_CALL(url_callback_, | 739 EXPECT_CALL(url_callback_, |
| 721 OnRequestCreate(JobListURI(kJobFetchReasonQueryMore), _)) | 740 OnRequestCreate(JobListURI(kJobFetchReasonQueryMore), _)) |
| 722 .Times(AtLeast(1)); | 741 .Times(AtLeast(1)); |
| 723 | 742 |
| 724 EXPECT_CALL(url_callback_, | 743 EXPECT_CALL(url_callback_, |
| 725 OnRequestCreate(JobListURI(kJobFetchReasonFailure), _)) | 744 OnRequestCreate(JobListURI(kJobFetchReasonFailure), _)) |
| 726 .Times(AtLeast(1)); | 745 .Times(AtLeast(1)); |
| 727 | 746 |
| 728 EXPECT_CALL(url_callback_, | 747 EXPECT_CALL(url_callback_, |
| 729 OnRequestCreate(JobListURI(kJobFetchReasonRetry), _)) | 748 OnRequestCreate(JobListURI(kJobFetchReasonRetry), _)) |
| 730 .Times(AtLeast(1)); | 749 .Times(AtLeast(1)); |
| 731 | 750 |
| 732 SetUpJobSuccessTest(1); | 751 SetUpJobSuccessTest(1); |
| 733 | 752 |
| 734 factory_.SetFakeResponse(TicketURI(1), | 753 factory_.SetFakeResponse(TicketURI(1), |
| 735 std::string(), | 754 std::string(), |
| 736 net::HTTP_INTERNAL_SERVER_ERROR); | 755 net::HTTP_INTERNAL_SERVER_ERROR, |
| 756 net::URLRequestStatus::FAILED); |
| 737 | 757 |
| 738 loop_.PostDelayedTask(FROM_HERE, | 758 loop_.PostDelayedTask(FROM_HERE, |
| 739 base::Bind(&net::FakeURLFetcherFactory::SetFakeResponse, | 759 base::Bind(&net::FakeURLFetcherFactory::SetFakeResponse, |
| 740 base::Unretained(&factory_), | 760 base::Unretained(&factory_), |
| 741 TicketURI(1), | 761 TicketURI(1), |
| 742 kExamplePrintTicket, | 762 kExamplePrintTicket, |
| 743 net::HTTP_OK), | 763 net::HTTP_OK, |
| 764 net::URLRequestStatus::SUCCESS), |
| 744 base::TimeDelta::FromSeconds(1)); | 765 base::TimeDelta::FromSeconds(1)); |
| 745 | 766 |
| 746 | 767 |
| 747 BeginTest(5); | 768 BeginTest(5); |
| 748 } | 769 } |
| 749 | 770 |
| 750 | 771 |
| 751 // TODO(noamsml): Figure out how to make this test not take ~64-~2048 (depending | 772 // TODO(noamsml): Figure out how to make this test not take ~64-~2048 (depending |
| 752 // constant values) seconds and re-enable it | 773 // constant values) seconds and re-enable it |
| 753 TEST_F(PrinterJobHandlerTest, DISABLED_CompleteFailureTest) { | 774 TEST_F(PrinterJobHandlerTest, DISABLED_CompleteFailureTest) { |
| 754 factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup), | 775 factory_.SetFakeResponse(JobListURI(kJobFetchReasonStartup), |
| 755 JobListResponse(1), net::HTTP_OK); | 776 JobListResponse(1), net::HTTP_OK, |
| 777 net::URLRequestStatus::SUCCESS); |
| 756 factory_.SetFakeResponse(JobListURI(kJobFetchReasonFailure), | 778 factory_.SetFakeResponse(JobListURI(kJobFetchReasonFailure), |
| 757 JobListResponse(1), net::HTTP_OK); | 779 JobListResponse(1), net::HTTP_OK, |
| 780 net::URLRequestStatus::SUCCESS); |
| 758 factory_.SetFakeResponse(JobListURI(kJobFetchReasonRetry), | 781 factory_.SetFakeResponse(JobListURI(kJobFetchReasonRetry), |
| 759 JobListResponse(1), net::HTTP_OK); | 782 JobListResponse(1), net::HTTP_OK, |
| 783 net::URLRequestStatus::SUCCESS); |
| 760 factory_.SetFakeResponse(ErrorURI(1), StatusResponse(1, "ERROR"), | 784 factory_.SetFakeResponse(ErrorURI(1), StatusResponse(1, "ERROR"), |
| 761 net::HTTP_OK); | 785 net::HTTP_OK, net::URLRequestStatus::SUCCESS); |
| 762 factory_.SetFakeResponse(TicketURI(1), std::string(), | 786 factory_.SetFakeResponse(TicketURI(1), std::string(), |
| 763 net::HTTP_INTERNAL_SERVER_ERROR); | 787 net::HTTP_INTERNAL_SERVER_ERROR, |
| 788 net::URLRequestStatus::FAILED); |
| 764 | 789 |
| 765 EXPECT_CALL(url_callback_, | 790 EXPECT_CALL(url_callback_, |
| 766 OnRequestCreate(JobListURI(kJobFetchReasonStartup), _)) | 791 OnRequestCreate(JobListURI(kJobFetchReasonStartup), _)) |
| 767 .Times(AtLeast(1)); | 792 .Times(AtLeast(1)); |
| 768 | 793 |
| 769 EXPECT_CALL(url_callback_, | 794 EXPECT_CALL(url_callback_, |
| 770 OnRequestCreate(JobListURI(kJobFetchReasonFailure), _)) | 795 OnRequestCreate(JobListURI(kJobFetchReasonFailure), _)) |
| 771 .Times(AtLeast(1)); | 796 .Times(AtLeast(1)); |
| 772 | 797 |
| 773 EXPECT_CALL(url_callback_, | 798 EXPECT_CALL(url_callback_, |
| 774 OnRequestCreate(JobListURI(kJobFetchReasonRetry), _)) | 799 OnRequestCreate(JobListURI(kJobFetchReasonRetry), _)) |
| 775 .Times(AtLeast(1)); | 800 .Times(AtLeast(1)); |
| 776 | 801 |
| 777 EXPECT_CALL(url_callback_, OnRequestCreate(ErrorURI(1), _)) | 802 EXPECT_CALL(url_callback_, OnRequestCreate(ErrorURI(1), _)) |
| 778 .Times(Exactly(1)) | 803 .Times(Exactly(1)) |
| 779 .WillOnce(InvokeWithoutArgs( | 804 .WillOnce(InvokeWithoutArgs( |
| 780 this, &PrinterJobHandlerTest::MakeJobFetchReturnNoJobs)); | 805 this, &PrinterJobHandlerTest::MakeJobFetchReturnNoJobs)); |
| 781 | 806 |
| 782 EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(1), _)) | 807 EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(1), _)) |
| 783 .Times(AtLeast(kNumRetriesBeforeAbandonJob)); | 808 .Times(AtLeast(kNumRetriesBeforeAbandonJob)); |
| 784 | 809 |
| 785 BeginTest(70); | 810 BeginTest(70); |
| 786 } | 811 } |
| 787 | 812 |
| 788 } // namespace cloud_print | 813 } // namespace cloud_print |
| OLD | NEW |