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" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 } // namespace | 245 } // namespace |
246 | 246 |
247 class CloudPrintURLFetcherNoServiceProcess | 247 class CloudPrintURLFetcherNoServiceProcess |
248 : public CloudPrintURLFetcher { | 248 : public CloudPrintURLFetcher { |
249 public: | 249 public: |
250 CloudPrintURLFetcherNoServiceProcess() : | 250 CloudPrintURLFetcherNoServiceProcess() : |
251 context_getter_(new net::TestURLRequestContextGetter( | 251 context_getter_(new net::TestURLRequestContextGetter( |
252 base::MessageLoopProxy::current())) {} | 252 base::MessageLoopProxy::current())) {} |
253 protected: | 253 protected: |
254 virtual net::URLRequestContextGetter* GetRequestContextGetter() OVERRIDE { | 254 virtual net::URLRequestContextGetter* GetRequestContextGetter() override { |
255 return context_getter_.get(); | 255 return context_getter_.get(); |
256 } | 256 } |
257 | 257 |
258 virtual ~CloudPrintURLFetcherNoServiceProcess() {} | 258 virtual ~CloudPrintURLFetcherNoServiceProcess() {} |
259 private: | 259 private: |
260 scoped_refptr<net::URLRequestContextGetter> context_getter_; | 260 scoped_refptr<net::URLRequestContextGetter> context_getter_; |
261 }; | 261 }; |
262 | 262 |
263 | 263 |
264 class CloudPrintURLFetcherNoServiceProcessFactory | 264 class CloudPrintURLFetcherNoServiceProcessFactory |
265 : public CloudPrintURLFetcherFactory { | 265 : public CloudPrintURLFetcherFactory { |
266 public: | 266 public: |
267 virtual CloudPrintURLFetcher* CreateCloudPrintURLFetcher() OVERRIDE { | 267 virtual CloudPrintURLFetcher* CreateCloudPrintURLFetcher() override { |
268 return new CloudPrintURLFetcherNoServiceProcess; | 268 return new CloudPrintURLFetcherNoServiceProcess; |
269 } | 269 } |
270 | 270 |
271 virtual ~CloudPrintURLFetcherNoServiceProcessFactory() {} | 271 virtual ~CloudPrintURLFetcherNoServiceProcessFactory() {} |
272 }; | 272 }; |
273 | 273 |
274 | 274 |
275 // This class handles the callback from FakeURLFetcher | 275 // This class handles the callback from FakeURLFetcher |
276 // It is a separate class because callback methods must be | 276 // It is a separate class because callback methods must be |
277 // on RefCounted classes | 277 // on RefCounted classes |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 private: | 434 private: |
435 scoped_refptr<MockJobSpooler> job_spooler_; | 435 scoped_refptr<MockJobSpooler> job_spooler_; |
436 scoped_refptr<MockPrinterWatcher> printer_watcher_; | 436 scoped_refptr<MockPrinterWatcher> printer_watcher_; |
437 scoped_refptr<MockPrintServerWatcher> print_server_watcher_; | 437 scoped_refptr<MockPrintServerWatcher> print_server_watcher_; |
438 }; | 438 }; |
439 | 439 |
440 | 440 |
441 class PrinterJobHandlerTest : public ::testing::Test { | 441 class PrinterJobHandlerTest : public ::testing::Test { |
442 public: | 442 public: |
443 PrinterJobHandlerTest(); | 443 PrinterJobHandlerTest(); |
444 virtual void SetUp() OVERRIDE; | 444 virtual void SetUp() override; |
445 virtual void TearDown() OVERRIDE; | 445 virtual void TearDown() override; |
446 void IdleOut(); | 446 void IdleOut(); |
447 bool GetPrinterInfo(printing::PrinterBasicInfo* info); | 447 bool GetPrinterInfo(printing::PrinterBasicInfo* info); |
448 void SendCapsAndDefaults( | 448 void SendCapsAndDefaults( |
449 const std::string& printer_name, | 449 const std::string& printer_name, |
450 const PrintSystem::PrinterCapsAndDefaultsCallback& callback); | 450 const PrintSystem::PrinterCapsAndDefaultsCallback& callback); |
451 void AddMimeHeader(const GURL& url, net::FakeURLFetcher* fetcher); | 451 void AddMimeHeader(const GURL& url, net::FakeURLFetcher* fetcher); |
452 void AddTicketMimeHeader(const GURL& url, net::FakeURLFetcher* fetcher); | 452 void AddTicketMimeHeader(const GURL& url, net::FakeURLFetcher* fetcher); |
453 bool PostSpoolSuccess(); | 453 bool PostSpoolSuccess(); |
454 void SetUpJobSuccessTest(int job_num); | 454 void SetUpJobSuccessTest(int job_num); |
455 void BeginTest(int timeout_seconds); | 455 void BeginTest(int timeout_seconds); |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 .WillOnce(InvokeWithoutArgs( | 817 .WillOnce(InvokeWithoutArgs( |
818 this, &PrinterJobHandlerTest::MakeJobFetchReturnNoJobs)); | 818 this, &PrinterJobHandlerTest::MakeJobFetchReturnNoJobs)); |
819 | 819 |
820 EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(1), _)) | 820 EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(1), _)) |
821 .Times(AtLeast(kNumRetriesBeforeAbandonJob)); | 821 .Times(AtLeast(kNumRetriesBeforeAbandonJob)); |
822 | 822 |
823 BeginTest(70); | 823 BeginTest(70); |
824 } | 824 } |
825 | 825 |
826 } // namespace cloud_print | 826 } // namespace cloud_print |
OLD | NEW |