Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: chrome/browser/local_discovery/privet_http_unittest.cc

Issue 624173002: replace OVERRIDE and FINAL with override and final in chrome/browser/[j-q]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "chrome/browser/local_discovery/privet_http_impl.h" 9 #include "chrome/browser/local_discovery/privet_http_impl.h"
10 #include "net/base/host_port_pair.h" 10 #include "net/base/host_port_pair.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 class MockRegisterDelegate : public PrivetRegisterOperation::Delegate { 375 class MockRegisterDelegate : public PrivetRegisterOperation::Delegate {
376 public: 376 public:
377 MockRegisterDelegate() { 377 MockRegisterDelegate() {
378 } 378 }
379 ~MockRegisterDelegate() { 379 ~MockRegisterDelegate() {
380 } 380 }
381 381
382 virtual void OnPrivetRegisterClaimToken( 382 virtual void OnPrivetRegisterClaimToken(
383 PrivetRegisterOperation* operation, 383 PrivetRegisterOperation* operation,
384 const std::string& token, 384 const std::string& token,
385 const GURL& url) OVERRIDE { 385 const GURL& url) override {
386 OnPrivetRegisterClaimTokenInternal(token, url); 386 OnPrivetRegisterClaimTokenInternal(token, url);
387 } 387 }
388 388
389 MOCK_METHOD2(OnPrivetRegisterClaimTokenInternal, void( 389 MOCK_METHOD2(OnPrivetRegisterClaimTokenInternal, void(
390 const std::string& token, 390 const std::string& token,
391 const GURL& url)); 391 const GURL& url));
392 392
393 virtual void OnPrivetRegisterError( 393 virtual void OnPrivetRegisterError(
394 PrivetRegisterOperation* operation, 394 PrivetRegisterOperation* operation,
395 const std::string& action, 395 const std::string& action,
396 PrivetRegisterOperation::FailureReason reason, 396 PrivetRegisterOperation::FailureReason reason,
397 int printer_http_code, 397 int printer_http_code,
398 const base::DictionaryValue* json) OVERRIDE { 398 const base::DictionaryValue* json) override {
399 // TODO(noamsml): Save and test for JSON? 399 // TODO(noamsml): Save and test for JSON?
400 OnPrivetRegisterErrorInternal(action, reason, printer_http_code); 400 OnPrivetRegisterErrorInternal(action, reason, printer_http_code);
401 } 401 }
402 402
403 MOCK_METHOD3(OnPrivetRegisterErrorInternal, 403 MOCK_METHOD3(OnPrivetRegisterErrorInternal,
404 void(const std::string& action, 404 void(const std::string& action,
405 PrivetRegisterOperation::FailureReason reason, 405 PrivetRegisterOperation::FailureReason reason,
406 int printer_http_code)); 406 int printer_http_code));
407 407
408 virtual void OnPrivetRegisterDone( 408 virtual void OnPrivetRegisterDone(
409 PrivetRegisterOperation* operation, 409 PrivetRegisterOperation* operation,
410 const std::string& device_id) OVERRIDE { 410 const std::string& device_id) override {
411 OnPrivetRegisterDoneInternal(device_id); 411 OnPrivetRegisterDoneInternal(device_id);
412 } 412 }
413 413
414 MOCK_METHOD1(OnPrivetRegisterDoneInternal, 414 MOCK_METHOD1(OnPrivetRegisterDoneInternal,
415 void(const std::string& device_id)); 415 void(const std::string& device_id));
416 }; 416 };
417 417
418 class MockLocalPrintDelegate : public PrivetLocalPrintOperation::Delegate { 418 class MockLocalPrintDelegate : public PrivetLocalPrintOperation::Delegate {
419 public: 419 public:
420 MockLocalPrintDelegate() {} 420 MockLocalPrintDelegate() {}
(...skipping 13 matching lines...) Expand all
434 434
435 MOCK_METHOD1(OnPrivetPrintingErrorInternal, void(int http_code)); 435 MOCK_METHOD1(OnPrivetPrintingErrorInternal, void(int http_code));
436 }; 436 };
437 437
438 class PrivetInfoTest : public PrivetHTTPTest { 438 class PrivetInfoTest : public PrivetHTTPTest {
439 public: 439 public:
440 PrivetInfoTest() {} 440 PrivetInfoTest() {}
441 441
442 virtual ~PrivetInfoTest() {} 442 virtual ~PrivetInfoTest() {}
443 443
444 virtual void SetUp() OVERRIDE { 444 virtual void SetUp() override {
445 info_operation_ = privet_client_->CreateInfoOperation( 445 info_operation_ = privet_client_->CreateInfoOperation(
446 info_callback_.callback()); 446 info_callback_.callback());
447 } 447 }
448 448
449 protected: 449 protected:
450 scoped_ptr<PrivetJSONOperation> info_operation_; 450 scoped_ptr<PrivetJSONOperation> info_operation_;
451 StrictMock<MockJSONCallback> info_callback_; 451 StrictMock<MockJSONCallback> info_callback_;
452 }; 452 };
453 453
454 TEST_F(PrivetInfoTest, SuccessfulInfo) { 454 TEST_F(PrivetInfoTest, SuccessfulInfo) {
(...skipping 26 matching lines...) Expand all
481 fetcher->delegate()->OnURLFetchComplete(fetcher); 481 fetcher->delegate()->OnURLFetchComplete(fetcher);
482 } 482 }
483 483
484 class PrivetRegisterTest : public PrivetHTTPTest { 484 class PrivetRegisterTest : public PrivetHTTPTest {
485 public: 485 public:
486 PrivetRegisterTest() { 486 PrivetRegisterTest() {
487 } 487 }
488 virtual ~PrivetRegisterTest() { 488 virtual ~PrivetRegisterTest() {
489 } 489 }
490 490
491 virtual void SetUp() OVERRIDE { 491 virtual void SetUp() override {
492 info_operation_ = privet_client_->CreateInfoOperation( 492 info_operation_ = privet_client_->CreateInfoOperation(
493 info_callback_.callback()); 493 info_callback_.callback());
494 register_operation_ = 494 register_operation_ =
495 privet_client_->CreateRegisterOperation("example@google.com", 495 privet_client_->CreateRegisterOperation("example@google.com",
496 &register_delegate_); 496 &register_delegate_);
497 } 497 }
498 498
499 protected: 499 protected:
500 bool SuccessfulResponseToURL(const GURL& url, 500 bool SuccessfulResponseToURL(const GURL& url,
501 const std::string& response) { 501 const std::string& response) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 // deleted. 670 // deleted.
671 RunFor(base::TimeDelta::FromSeconds(3)); 671 RunFor(base::TimeDelta::FromSeconds(3));
672 } 672 }
673 673
674 class PrivetCapabilitiesTest : public PrivetHTTPTest { 674 class PrivetCapabilitiesTest : public PrivetHTTPTest {
675 public: 675 public:
676 PrivetCapabilitiesTest() {} 676 PrivetCapabilitiesTest() {}
677 677
678 virtual ~PrivetCapabilitiesTest() {} 678 virtual ~PrivetCapabilitiesTest() {}
679 679
680 virtual void SetUp() OVERRIDE { 680 virtual void SetUp() override {
681 capabilities_operation_ = privet_client_->CreateCapabilitiesOperation( 681 capabilities_operation_ = privet_client_->CreateCapabilitiesOperation(
682 capabilities_callback_.callback()); 682 capabilities_callback_.callback());
683 } 683 }
684 684
685 protected: 685 protected:
686 scoped_ptr<PrivetJSONOperation> capabilities_operation_; 686 scoped_ptr<PrivetJSONOperation> capabilities_operation_;
687 StrictMock<MockJSONCallback> capabilities_callback_; 687 StrictMock<MockJSONCallback> capabilities_callback_;
688 }; 688 };
689 689
690 TEST_F(PrivetCapabilitiesTest, SuccessfulCapabilities) { 690 TEST_F(PrivetCapabilitiesTest, SuccessfulCapabilities) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 public: 761 public:
762 FakePWGRasterConverter() { 762 FakePWGRasterConverter() {
763 } 763 }
764 764
765 virtual ~FakePWGRasterConverter() { 765 virtual ~FakePWGRasterConverter() {
766 } 766 }
767 767
768 virtual void Start(base::RefCountedMemory* data, 768 virtual void Start(base::RefCountedMemory* data,
769 const printing::PdfRenderSettings& conversion_settings, 769 const printing::PdfRenderSettings& conversion_settings,
770 const printing::PwgRasterSettings& bitmap_settings, 770 const printing::PwgRasterSettings& bitmap_settings,
771 const ResultCallback& callback) OVERRIDE { 771 const ResultCallback& callback) override {
772 bitmap_settings_ = bitmap_settings; 772 bitmap_settings_ = bitmap_settings;
773 std::string data_str(data->front_as<char>(), data->size()); 773 std::string data_str(data->front_as<char>(), data->size());
774 callback.Run(true, base::FilePath().AppendASCII(data_str + "test.pdf")); 774 callback.Run(true, base::FilePath().AppendASCII(data_str + "test.pdf"));
775 } 775 }
776 776
777 const printing::PwgRasterSettings& bitmap_settings() { 777 const printing::PwgRasterSettings& bitmap_settings() {
778 return bitmap_settings_; 778 return bitmap_settings_;
779 } 779 }
780 780
781 private: 781 private:
782 printing::PwgRasterSettings bitmap_settings_; 782 printing::PwgRasterSettings bitmap_settings_;
783 }; 783 };
784 784
785 class PrivetLocalPrintTest : public PrivetHTTPTest { 785 class PrivetLocalPrintTest : public PrivetHTTPTest {
786 public: 786 public:
787 PrivetLocalPrintTest() {} 787 PrivetLocalPrintTest() {}
788 788
789 virtual ~PrivetLocalPrintTest() {} 789 virtual ~PrivetLocalPrintTest() {}
790 790
791 virtual void SetUp() OVERRIDE { 791 virtual void SetUp() override {
792 PrivetURLFetcher::ResetTokenMapForTests(); 792 PrivetURLFetcher::ResetTokenMapForTests();
793 793
794 local_print_operation_ = privet_client_->CreateLocalPrintOperation( 794 local_print_operation_ = privet_client_->CreateLocalPrintOperation(
795 &local_print_delegate_); 795 &local_print_delegate_);
796 796
797 scoped_ptr<FakePWGRasterConverter> pwg_converter( 797 scoped_ptr<FakePWGRasterConverter> pwg_converter(
798 new FakePWGRasterConverter); 798 new FakePWGRasterConverter);
799 pwg_converter_ = pwg_converter.get(); 799 pwg_converter_ = pwg_converter.get();
800 local_print_operation_->SetPWGRasterConverterForTesting( 800 local_print_operation_->SetPWGRasterConverterForTesting(
801 pwg_converter.PassAs<PWGRasterConverter>()); 801 pwg_converter.PassAs<PWGRasterConverter>());
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 1073
1074 EXPECT_TRUE(SuccessfulResponseToURL( 1074 EXPECT_TRUE(SuccessfulResponseToURL(
1075 GURL("http://10.0.0.8:6006/privet/printer/createjob"), 1075 GURL("http://10.0.0.8:6006/privet/printer/createjob"),
1076 kSampleCreatejobResponse)); 1076 kSampleCreatejobResponse));
1077 } 1077 }
1078 #endif // ENABLE_FULL_PRINTING 1078 #endif // ENABLE_FULL_PRINTING
1079 1079
1080 } // namespace 1080 } // namespace
1081 1081
1082 } // namespace local_discovery 1082 } // namespace local_discovery
OLDNEW
« no previous file with comments | « chrome/browser/local_discovery/privet_http_impl.h ('k') | chrome/browser/local_discovery/privet_local_printer_lister.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698