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.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 } // namespace | 242 } // namespace |
243 | 243 |
244 class CloudPrintURLFetcherNoServiceProcess | 244 class CloudPrintURLFetcherNoServiceProcess |
245 : public CloudPrintURLFetcher { | 245 : public CloudPrintURLFetcher { |
246 public: | 246 public: |
247 CloudPrintURLFetcherNoServiceProcess() : | 247 CloudPrintURLFetcherNoServiceProcess() : |
248 context_getter_(new net::TestURLRequestContextGetter( | 248 context_getter_(new net::TestURLRequestContextGetter( |
249 base::MessageLoopProxy::current())) {} | 249 base::MessageLoopProxy::current())) {} |
250 protected: | 250 protected: |
251 virtual net::URLRequestContextGetter* GetRequestContextGetter() { | 251 virtual net::URLRequestContextGetter* GetRequestContextGetter() OVERRIDE { |
252 return context_getter_.get(); | 252 return context_getter_.get(); |
253 } | 253 } |
254 | 254 |
255 virtual ~CloudPrintURLFetcherNoServiceProcess() {} | 255 virtual ~CloudPrintURLFetcherNoServiceProcess() {} |
256 private: | 256 private: |
257 scoped_refptr<net::URLRequestContextGetter> context_getter_; | 257 scoped_refptr<net::URLRequestContextGetter> context_getter_; |
258 }; | 258 }; |
259 | 259 |
260 | 260 |
261 class CloudPrintURLFetcherNoServiceProcessFactory | 261 class CloudPrintURLFetcherNoServiceProcessFactory |
262 : public CloudPrintURLFetcherFactory { | 262 : public CloudPrintURLFetcherFactory { |
263 public: | 263 public: |
264 virtual CloudPrintURLFetcher* CreateCloudPrintURLFetcher() { | 264 virtual CloudPrintURLFetcher* CreateCloudPrintURLFetcher() OVERRIDE { |
265 return new CloudPrintURLFetcherNoServiceProcess; | 265 return new CloudPrintURLFetcherNoServiceProcess; |
266 } | 266 } |
267 | 267 |
268 virtual ~CloudPrintURLFetcherNoServiceProcessFactory() {} | 268 virtual ~CloudPrintURLFetcherNoServiceProcessFactory() {} |
269 }; | 269 }; |
270 | 270 |
271 | 271 |
272 // This class handles the callback from FakeURLFetcher | 272 // This class handles the callback from FakeURLFetcher |
273 // It is a separate class because callback methods must be | 273 // It is a separate class because callback methods must be |
274 // on RefCounted classes | 274 // on RefCounted classes |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 private: | 430 private: |
431 scoped_refptr<MockJobSpooler> job_spooler_; | 431 scoped_refptr<MockJobSpooler> job_spooler_; |
432 scoped_refptr<MockPrinterWatcher> printer_watcher_; | 432 scoped_refptr<MockPrinterWatcher> printer_watcher_; |
433 scoped_refptr<MockPrintServerWatcher> print_server_watcher_; | 433 scoped_refptr<MockPrintServerWatcher> print_server_watcher_; |
434 }; | 434 }; |
435 | 435 |
436 | 436 |
437 class PrinterJobHandlerTest : public ::testing::Test { | 437 class PrinterJobHandlerTest : public ::testing::Test { |
438 public: | 438 public: |
439 PrinterJobHandlerTest(); | 439 PrinterJobHandlerTest(); |
440 void SetUp() OVERRIDE; | 440 virtual void SetUp() OVERRIDE; |
441 void TearDown() OVERRIDE; | 441 virtual void TearDown() OVERRIDE; |
442 void IdleOut(); | 442 void IdleOut(); |
443 bool GetPrinterInfo(printing::PrinterBasicInfo* info); | 443 bool GetPrinterInfo(printing::PrinterBasicInfo* info); |
444 void SendCapsAndDefaults( | 444 void SendCapsAndDefaults( |
445 const std::string& printer_name, | 445 const std::string& printer_name, |
446 const PrintSystem::PrinterCapsAndDefaultsCallback& callback); | 446 const PrintSystem::PrinterCapsAndDefaultsCallback& callback); |
447 void AddMimeHeader(const GURL& url, net::FakeURLFetcher* fetcher); | 447 void AddMimeHeader(const GURL& url, net::FakeURLFetcher* fetcher); |
448 bool PostSpoolSuccess(); | 448 bool PostSpoolSuccess(); |
449 void SetUpJobSuccessTest(int job_num); | 449 void SetUpJobSuccessTest(int job_num); |
450 void BeginTest(int timeout_seconds); | 450 void BeginTest(int timeout_seconds); |
451 void MakeJobFetchReturnNoJobs(); | 451 void MakeJobFetchReturnNoJobs(); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 .WillOnce(InvokeWithoutArgs( | 776 .WillOnce(InvokeWithoutArgs( |
777 this, &PrinterJobHandlerTest::MakeJobFetchReturnNoJobs)); | 777 this, &PrinterJobHandlerTest::MakeJobFetchReturnNoJobs)); |
778 | 778 |
779 EXPECT_CALL(url_callback_, OnRequestCreate(GURL(TicketURI(1)), _)) | 779 EXPECT_CALL(url_callback_, OnRequestCreate(GURL(TicketURI(1)), _)) |
780 .Times(AtLeast(kNumRetriesBeforeAbandonJob)); | 780 .Times(AtLeast(kNumRetriesBeforeAbandonJob)); |
781 | 781 |
782 BeginTest(70); | 782 BeginTest(70); |
783 } | 783 } |
784 | 784 |
785 } // namespace cloud_print | 785 } // namespace cloud_print |
OLD | NEW |