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

Side by Side Diff: chrome/service/cloud_print/printer_job_handler_unittest.cc

Issue 12248009: Created unit test for PrinterJobHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@test_printerjobhandler
Patch Set: Created 7 years, 10 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
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/file_path.h"
6 #include "base/md5.h"
7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h"
11 #include "base/stringprintf.h"
12 #include "chrome/common/cloud_print/cloud_print_constants.h"
13 #include "chrome/service/cloud_print/cloud_print_helpers.h"
14 #include "chrome/service/cloud_print/cloud_print_token_store.h"
15 #include "chrome/service/cloud_print/print_system.h"
16 #include "chrome/service/cloud_print/printer_job_handler.h"
17 #include "net/http/http_response_headers.h"
18 #include "net/url_request/test_url_fetcher_factory.h"
19 #include "net/url_request/url_request_test_util.h"
20 #include "printing/backend/print_backend.h"
21 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gtest/include/gtest/gtest.h"
23
24 using ::testing::AtLeast;
25 using ::testing::Exactly;
26 using ::testing::Sequence;
27 using ::testing::Return;
28 using ::testing::SaveArg;
29 using ::testing::DoAll;
30 using ::testing::_;
31 using ::testing::NiceMock;
32 using ::testing::StrictMock;
33 using ::testing::Invoke;
34 using ::testing::SetArgPointee;
35 using ::testing::InvokeWithoutArgs;
36
37 namespace cloud_print {
38
39 const char kExampleJobListResponse[] = "{"
40 " \"success\": true,"
41 " \"jobs\": ["
42 " {"
43 " \"tags\": ["
44 " \"^own\""
45 " ],"
46 " \"printerName\": \"Example Printer\","
47 " \"status\": \"QUEUED\","
48 " \"ownerId\": \"sampleuser@gmail.com\","
49 " \"ticketUrl\": \"https://www.google.com/cloudprint/ticket?exampleURI1\","
50 " \"printerid\": \"__example_printer_id\","
51 " \"printerType\": \"GOOGLE\","
52 " \"contentType\": \"text/html\","
53 " \"fileUrl\": \"https://www.google.com/cloudprint/download?exampleURI1\","
54 " \"id\": \"__example_job_id1\","
55 " \"message\": \"\","
56 " \"title\": \"Example Job 1\","
57 " \"errorCode\": \"\","
58 " \"numberOfPages\": 3"
59 " }"
60 " ],"
61 " \"xsrf_token\": \"AIp06DjUd3AV6BO0aujB9NvM2a9ZbogxOQ:1360021066932\","
62 " \"request\": {"
63 " \"time\": \"0\","
64 " \"users\": ["
65 " \"sampleuser@gmail.com\""
66 " ],"
67 " \"params\": {"
68 " \"printerid\": ["
69 " \"__example_printer_id\""
70 " ]"
71 " },"
72 " \"user\": \"sampleuser@gmail.com\""
73 " }"
74 "}";
75
76 const char kExampleJobListResponseEmpty[] = "{"
77 " \"success\": true,"
78 " \"jobs\": ["
79 " ],"
80 " \"xsrf_token\": \"AIp06DjUd3AV6BO0aujB9NvM2a9ZbogxOQ:1360021066932\","
81 " \"request\": {"
82 " \"time\": \"0\","
83 " \"users\": ["
84 " \"sampleuser@gmail.com\""
85 " ],"
86 " \"params\": {"
87 " \"printerid\": ["
88 " \"__example_printer_id\""
89 " ]"
90 " },"
91 " \"user\": \"sampleuser@gmail.com\""
92 " }"
93 "}";
94
95
96
97 const char kExampleJobID[] = "__example_job_id1";
98
99 const char kExampleCloudPrintServerURL[] = "https://www.google.com/cloudprint/";
100
101 const char kExamplePrintTicket[] = "{\"MediaType\":\"plain\","
102 "\"Resolution\":\"300x300dpi\",\"PageRegion\":\"Letter\","
103 "\"InputSlot\":\"auto\",\"PageSize\":\"Letter\",\"EconoMode\":\"off\"}";
104
105 const char kExamplePrintTicketURI[] =
106 "https://www.google.com/cloudprint/ticket?exampleURI1";
107
108 const char kExamplePrintDownloadURI[] =
109 "https://www.google.com/cloudprint/download?exampleURI1";
110
111 // Use StringPrintf to construct
112 const char kExamplePrinterJobListURI[] =
113 "https://www.google.com/cloudprint/fetch"
114 "?printerid=__example_printer_id&deb=%s";
115
116 // Use StringPrintf to construct
117 const char kExamplePrinterJobControlURI[] =
118 "https://www.google.com/cloudprint/control"
119 "?jobid=__example_printer_id&status=%s";
120
121
122 // Use StringPrintf to construct
123 const char kExampleControlResponse[] = "{"
124 " \"success\": true,"
125 " \"message\": \"Print job updated successfully.\","
126 " \"xsrf_token\": \"AIp06DjKgbfGalbqzj23V1bU6i-vtR2B4w:1360023068789\","
127 " \"request\": {"
128 " \"time\": \"0\","
129 " \"users\": ["
130 " \"sampleuser@gmail.com\""
131 " ],"
132 " \"params\": {"
133 " \"xsrf\": ["
134 " \"AIp06DgeGIETs42Cj28QWmxGPWVDiaXwVQ:1360023041852\""
135 " ],"
136 " \"status\": ["
137 " \"%s\""
138 " ],"
139 " \"jobid\": ["
140 " \"__example_job_id1\""
141 " ]"
142 " },"
143 " \"user\": \"sampleuser@gmail.com\""
144 " },"
145 " \"job\": {"
146 " \"tags\": ["
147 " \"^own\""
148 " ],"
149 " \"printerName\": \"Example Printer\","
150 " \"status\": \"%s\","
151 " \"ownerId\": \"sampleuser@gmail.com\","
152 " \"ticketUrl\": \"https://www.google.com/cloudprint/ticket?exampleURI1\","
153 " \"printerid\": \"__example_printer_id\","
154 " \"contentType\": \"text/html\","
155 " \"fileUrl\": \"https://www.google.com/cloudprint/download?exampleURI1\","
156 " \"id\": \"__example_job_id1\","
157 " \"message\": \"\","
158 " \"title\": \"Example Job\","
159 " \"errorCode\": \"\","
160 " \"numberOfPages\": 3"
161 " }"
162 "}";
163
164 const char kExamplePrinterID[] = "__example_printer_id";
165
166 const char kExamplePrinterCapabilities[] = "";
167
168 const char kExampleCapsMimeType[] = "";
169
170 // These can stay empty
171 const char kExampleDefaults[] = "";
172
173 const char kExampleDefaultMimeType[] = "";
174
175 // Since we're not connecting to the server, this can be any non-empty string.
176 const char kExampleCloudPrintOAuthToken[] = "__SAMPLE_TOKEN";
177
178
179 // Not actually printing, no need for real PDF.
180 const char kExamplePrintData[] = "__EXAMPLE_PRINT_DATA";
181
182 const char kExampleJobDownloadResponseHeaders[] =
183 "Content-Type: Application/PDF\n";
184
185 const char kExampleUpdateDoneURL[] =
186 "https://www.google.com/cloudprint/control?jobid=__example_job_id1"
187 "&status=DONE&code=0&message=&numpages=0&pagesprinted=0";
188
189 const char kExamplePrinterName[] = "Example Printer";
190
191 const char kExamplePrinterDescription[] = "Example Description";
192
193 class CloudPrintURLFetcherNoServiceProcess
194 : public CloudPrintURLFetcher {
195 protected:
196 virtual net::URLRequestContextGetter* GetRequestContextGetter() {
197 return new net::TestURLRequestContextGetter(
198 base::MessageLoopProxy::current());
199 }
200
201 virtual ~CloudPrintURLFetcherNoServiceProcess() {}
202 };
203
204
205 class CloudPrintURLFetcherNoServiceProcessFactory
206 : public CloudPrintURLFetcherFactory {
207 public:
208 virtual CloudPrintURLFetcher* CreateCloudPrintURLFetcher() {
209 return new CloudPrintURLFetcherNoServiceProcess;
210 }
211
212 virtual ~CloudPrintURLFetcherNoServiceProcessFactory() {}
213 };
214
215
216 // This class handles the callback from FakeURLFetcher
217 // It is a separate class because callback methods must be
218 // on RefCounted classes
219
220 class TestURLFetcherCallback {
221 public:
222 scoped_ptr<net::FakeURLFetcher> CreateURLFetcher(
223 const GURL& url,
224 net::URLFetcherDelegate* d,
225 const std::string& response_data,
226 bool success) {
227 scoped_ptr<net::FakeURLFetcher> fetcher(
228 new net::FakeURLFetcher(url, d, response_data, success));
229 OnRequestCreate(url, fetcher.get());
230 return fetcher.Pass();
231 }
232 MOCK_METHOD2(OnRequestCreate,
233 void(const GURL&, net::FakeURLFetcher*));
234 };
235
236
237 class MockPrinterJobHandlerDelegate
238 : public PrinterJobHandler::Delegate {
239 public:
240 MOCK_METHOD0(OnAuthError, void());
241 MOCK_METHOD1(OnPrinterDeleted, void(const std::string& str));
242
243 virtual ~MockPrinterJobHandlerDelegate() {}
244 };
245
246
247 class MockPrintServerWatcher
248 : public PrintSystem::PrintServerWatcher {
249 public:
250 MOCK_METHOD1(StartWatching,
251 bool(PrintSystem::PrintServerWatcher::Delegate* d));
252 MOCK_METHOD0(StopWatching, bool());
253
254 MockPrintServerWatcher();
255 PrintSystem::PrintServerWatcher::Delegate* delegate() const {
256 return delegate_;
257 }
258
259 friend class scoped_refptr<NiceMock<MockPrintServerWatcher> >;
260 friend class scoped_refptr<StrictMock<MockPrintServerWatcher> >;
261 friend class scoped_refptr<MockPrintServerWatcher>;
262
263 protected:
264 virtual ~MockPrintServerWatcher() {}
265
266 private:
267 PrintSystem::PrintServerWatcher::Delegate* delegate_;
268 };
269
270 class MockPrinterWatcher : public PrintSystem::PrinterWatcher {
271 public:
272 MOCK_METHOD1(StartWatching, bool(PrintSystem::PrinterWatcher::Delegate* d));
273 MOCK_METHOD0(StopWatching, bool());
274 MOCK_METHOD1(GetCurrentPrinterInfo,
275 bool(printing::PrinterBasicInfo* printer_info));
276
277 MockPrinterWatcher();
278 PrintSystem::PrinterWatcher::Delegate* delegate() const { return delegate_; }
279
280 friend class scoped_refptr<NiceMock<MockPrinterWatcher> >;
281 friend class scoped_refptr<StrictMock<MockPrinterWatcher> >;
282 friend class scoped_refptr<MockPrinterWatcher>;
283
284 protected:
285 virtual ~MockPrinterWatcher() {}
286
287 private:
288 PrintSystem::PrinterWatcher::Delegate* delegate_;
289 };
290
291
292 class MockJobSpooler : public PrintSystem::JobSpooler {
293 public:
294 MOCK_METHOD7(Spool, bool(
295 const std::string& print_ticket,
296 const base::FilePath& print_data_file_path,
297 const std::string& print_data_mime_type,
298 const std::string& printer_name,
299 const std::string& job_title,
300 const std::vector<std::string>& tags,
301 PrintSystem::JobSpooler::Delegate* delegate));
302
303 MockJobSpooler();
304 PrintSystem::JobSpooler::Delegate* delegate() const { return delegate_; }
305
306 friend class scoped_refptr<NiceMock<MockJobSpooler> >;
307 friend class scoped_refptr<StrictMock<MockJobSpooler> >;
308 friend class scoped_refptr<MockJobSpooler>;
309
310 protected:
311 virtual ~MockJobSpooler() {}
312
313 private:
314 PrintSystem::JobSpooler::Delegate* delegate_;
315 };
316
317
318
319 class MockPrintSystem : public PrintSystem {
320 public:
321 MockPrintSystem();
322 PrintSystem::PrintSystemResult succeed() {
323 return PrintSystem::PrintSystemResult(true, "success");
324 }
325
326 PrintSystem::PrintSystemResult fail() {
327 return PrintSystem::PrintSystemResult(false, "failure");
328 }
329
330 MockJobSpooler& JobSpooler() {
331 return *job_spooler_;
332 }
333
334 MockPrinterWatcher& PrinterWatcher() {
335 return *printer_watcher_;
336 }
337
338 MockPrintServerWatcher& PrintServerWatcher() {
339 return *print_server_watcher_;
340 }
341
342 MOCK_METHOD0(Init, PrintSystem::PrintSystemResult());
343 MOCK_METHOD1(EnumeratePrinters, PrintSystem::PrintSystemResult(
344 printing::PrinterList* printer_list));
345
346 MOCK_METHOD2(
347 GetPrinterCapsAndDefaults,
348 void(const std::string& printer_name,
349 const PrintSystem::PrinterCapsAndDefaultsCallback& callback));
350
351 MOCK_METHOD1(IsValidPrinter, bool(const std::string& printer_name));
352
353 MOCK_METHOD2(ValidatePrintTicket, bool(const std::string& printer_name,
354 const std::string& print_ticket_data));
355
356 MOCK_METHOD3(GetJobDetails, bool(const std::string& printer_name,
357 PlatformJobId job_id,
358 PrintJobDetails* job_details));
359
360 MOCK_METHOD0(CreatePrintServerWatcher, PrintSystem::PrintServerWatcher*());
361 MOCK_METHOD1(CreatePrinterWatcher,
362 PrintSystem::PrinterWatcher*(const std::string& printer_name));
363 MOCK_METHOD0(CreateJobSpooler, PrintSystem::JobSpooler*());
364
365 MOCK_METHOD0(GetSupportedMimeTypes, std::string());
366
367 friend class scoped_refptr<NiceMock<MockPrintSystem> >;
368 friend class scoped_refptr<StrictMock<MockPrintSystem> >;
369 friend class scoped_refptr<MockPrintSystem>;
370
371 protected:
372 virtual ~MockPrintSystem() {}
373
374 private:
375 scoped_refptr<MockJobSpooler> job_spooler_;
376 scoped_refptr<MockPrinterWatcher> printer_watcher_;
377 scoped_refptr<MockPrintServerWatcher> print_server_watcher_;
378 };
379
380
381 class PrinterJobHandlerTest : public ::testing::Test {
382 public:
383 PrinterJobHandlerTest();
384 void SetUp() OVERRIDE;
385 void TearDown() OVERRIDE;
386 void IdleOut();
387 bool GetPrinterInfo(printing::PrinterBasicInfo* info);
388 void SendCapsAndDefaults(
389 const std::string& printer_name,
390 const PrintSystem::PrinterCapsAndDefaultsCallback& callback);
391 void AddMimeHeader(const GURL& url, net::FakeURLFetcher* fetcher);
392 bool PostSpoolSuccess();
393
394 static void MessageLoopQuitNowHelper(MessageLoop* message_loop);
395 static void MessageLoopQuitSoonHelper(MessageLoop* message_loop);
396
397 MessageLoopForIO loop_;
398 TestURLFetcherCallback url_callback_;
399 MockPrinterJobHandlerDelegate jobhandler_delegate_;
400 CloudPrintTokenStore token_store_;
401 CloudPrintURLFetcherNoServiceProcessFactory cloud_print_factory_;
402 scoped_refptr<PrinterJobHandler> job_handler_;
403 scoped_refptr<NiceMock<MockPrintSystem> > print_system_;
404 net::FakeURLFetcherFactory factory_;
405 printing::PrinterBasicInfo basic_info_;
406 printing::PrinterCapsAndDefaults caps_and_defaults_;
407 PrinterJobHandler::PrinterInfoFromCloud info_from_cloud_;
408 };
409
410
411 void PrinterJobHandlerTest::SetUp() {
412 basic_info_.printer_name = kExamplePrinterName;
413 basic_info_.printer_description = kExamplePrinterDescription;
414 basic_info_.is_default = 0;
415
416 info_from_cloud_.printer_id = kExamplePrinterID;
417 info_from_cloud_.tags_hash = GetHashOfPrinterInfo(basic_info_);
418
419 info_from_cloud_.caps_hash = base::MD5String(kExamplePrinterCapabilities);
420
421 caps_and_defaults_.printer_capabilities = kExamplePrinterCapabilities;
422 caps_and_defaults_.caps_mime_type = kExampleCapsMimeType;
423 caps_and_defaults_.printer_defaults = kExampleDefaults;
424 caps_and_defaults_.defaults_mime_type = kExampleDefaultMimeType;
425
426 print_system_ = new NiceMock<MockPrintSystem>();
427
428 token_store_.SetToken(kExampleCloudPrintOAuthToken);
429
430 ON_CALL(print_system_->PrinterWatcher(), GetCurrentPrinterInfo(_))
431 .WillByDefault(Invoke(this, &PrinterJobHandlerTest::GetPrinterInfo));
432
433 ON_CALL(*print_system_, GetPrinterCapsAndDefaults(_, _))
434 .WillByDefault(Invoke(this, &PrinterJobHandlerTest::SendCapsAndDefaults));
435
436 CloudPrintURLFetcher::set_factory(&cloud_print_factory_);
437 }
438
439 void PrinterJobHandlerTest::MessageLoopQuitNowHelper(
440 MessageLoop* message_loop) {
441 message_loop->QuitWhenIdle();
442 }
443
444 void PrinterJobHandlerTest::MessageLoopQuitSoonHelper(
445 MessageLoop* message_loop) {
446 message_loop->message_loop_proxy()->PostTask(
447 FROM_HERE,
448 base::Bind(&MessageLoopQuitNowHelper, message_loop));
449 }
450
451 PrinterJobHandlerTest::PrinterJobHandlerTest()
452 : factory_(NULL, base::Bind(&TestURLFetcherCallback::CreateURLFetcher,
453 base::Unretained(&url_callback_))) {
454 }
455
456 bool PrinterJobHandlerTest::PostSpoolSuccess() {
457 MessageLoop::current()->PostTask(
458 FROM_HERE,
459 base::Bind(
460 &PrinterJobHandler::OnJobSpoolSucceeded,
461 job_handler_, 0));
462
463 // Everything that would be posted on the printer thread queue
464 // has been posted, we can tell the main message loop to quit when idle
465 // and not worry about it idling while the print thread does work
466 MessageLoop::current()->PostTask(FROM_HERE,
467 base::Bind(&MessageLoopQuitSoonHelper, &loop_));
468 return true;
469 }
470
471 void PrinterJobHandlerTest::AddMimeHeader(const GURL& url,
472 net::FakeURLFetcher* fetcher) {
473 scoped_refptr<net::HttpResponseHeaders> download_headers =
474 new net::HttpResponseHeaders(kExampleJobDownloadResponseHeaders);
475 fetcher->set_response_headers(download_headers);
476 }
477
478
479 void PrinterJobHandlerTest::SendCapsAndDefaults(
480 const std::string& printer_name,
481 const PrintSystem::PrinterCapsAndDefaultsCallback& callback) {
482 callback.Run(true, printer_name, caps_and_defaults_);
483 }
484
485 bool PrinterJobHandlerTest::GetPrinterInfo(printing::PrinterBasicInfo* info) {
486 *info = basic_info_;
487 return true;
488 }
489
490 void PrinterJobHandlerTest::TearDown() {
491 IdleOut();
492 CloudPrintURLFetcher::set_factory(NULL);
493 }
494
495 void PrinterJobHandlerTest::IdleOut() {
496 MessageLoop::current()->RunUntilIdle();
497 }
498
499 MockPrintServerWatcher::MockPrintServerWatcher() : delegate_(NULL) {
500 ON_CALL(*this, StartWatching(_))
501 .WillByDefault(DoAll(SaveArg<0>(&delegate_), Return(true)));
502 ON_CALL(*this, StopWatching()).WillByDefault(Return(true));
503 }
504
505
506 MockPrinterWatcher::MockPrinterWatcher() : delegate_(NULL) {
507 ON_CALL(*this, StartWatching(_))
508 .WillByDefault(DoAll(SaveArg<0>(&delegate_), Return(true)));
509 ON_CALL(*this, StopWatching()).WillByDefault(Return(true));
510 }
511
512 MockJobSpooler::MockJobSpooler() : delegate_(NULL) {
513 ON_CALL(*this, Spool(_, _, _, _, _, _, _))
514 .WillByDefault(DoAll(SaveArg<6>(&delegate_), Return(true)));
515 }
516
517
518 MockPrintSystem::MockPrintSystem()
519 : job_spooler_(new NiceMock<MockJobSpooler>()),
520 printer_watcher_(new NiceMock<MockPrinterWatcher>()),
521 print_server_watcher_(new NiceMock<MockPrintServerWatcher>()) {
522 ON_CALL(*this, CreateJobSpooler())
523 .WillByDefault(Return(job_spooler_));
524
525 ON_CALL(*this, CreatePrinterWatcher(_))
526 .WillByDefault(Return(printer_watcher_));
527
528 ON_CALL(*this, CreatePrintServerWatcher())
529 .WillByDefault(Return(print_server_watcher_));
530
531 ON_CALL(*this, IsValidPrinter(_)).
532 WillByDefault(Return(true));
533
534 ON_CALL(*this, ValidatePrintTicket(_, _)).
535 WillByDefault(Return(true));
536 };
537
538 // This test simulates an end-to-end printing of a document
539 // but tests only non-failure cases.
540 TEST_F(PrinterJobHandlerTest, HappyPathTest) {
541 GURL InProgressURL =
542 GetUrlForJobStatusUpdate(GURL(kExampleCloudPrintServerURL),
543 kExampleJobID,
544 PRINT_JOB_STATUS_IN_PROGRESS);
545
546 factory_.SetFakeResponse(kExamplePrintTicketURI, kExamplePrintTicket, true);
547 factory_.SetFakeResponse(kExamplePrintDownloadURI, kExamplePrintData, true);
548 factory_.SetFakeResponse(
549 StringPrintf(kExamplePrinterJobListURI, kJobFetchReasonStartup),
550 kExampleJobListResponse, true);
551
552
553 factory_.SetFakeResponse(
554 base::StringPrintf(kExamplePrinterJobListURI, kJobFetchReasonQueryMore),
555 kExampleJobListResponseEmpty, true);
556
557 factory_.SetFakeResponse(
558 kExampleUpdateDoneURL,
559 base::StringPrintf(kExampleControlResponse, "DONE", "DONE"), true);
560
561 factory_.SetFakeResponse(
562 InProgressURL.spec(),
563 base::StringPrintf(kExampleControlResponse,
564 "IN_PROGRESS", "IN_PROGRESS"),
565 true);
566
567
568 job_handler_ = new PrinterJobHandler(basic_info_, info_from_cloud_,
569 GURL(kExampleCloudPrintServerURL),
570 print_system_, &jobhandler_delegate_);
571
572 EXPECT_CALL(url_callback_, OnRequestCreate(
573 GURL(base::StringPrintf(kExamplePrinterJobListURI, "startup")), _))
574 .Times(Exactly(1));
575
576 EXPECT_CALL(url_callback_, OnRequestCreate(
577 GURL(base::StringPrintf(kExamplePrinterJobListURI, "querymore")), _))
578 .Times(Exactly(1));
579
580 EXPECT_CALL(url_callback_, OnRequestCreate(GURL(kExamplePrintTicketURI), _))
581 .Times(Exactly(1));
582
583 EXPECT_CALL(url_callback_, OnRequestCreate(
584 GURL(kExamplePrintDownloadURI), _))
585 .Times(Exactly(1))
586 .WillOnce(Invoke(this, &PrinterJobHandlerTest::AddMimeHeader));
587
588 EXPECT_CALL(url_callback_, OnRequestCreate(InProgressURL, _))
589 .Times(Exactly(1));
590
591 EXPECT_CALL(url_callback_, OnRequestCreate(GURL(kExampleUpdateDoneURL), _))
592 .Times(Exactly(1));
593
594 EXPECT_CALL(print_system_->JobSpooler(),
595 Spool(kExamplePrintTicket, _, _, _, _, _, _))
596 .Times(Exactly(1))
597 .WillOnce(InvokeWithoutArgs(this,
598 &PrinterJobHandlerTest::PostSpoolSuccess));
599
600
601 job_handler_->Initialize();
602
603 MessageLoop::current()->PostDelayedTask(
604 FROM_HERE,
605 base::Bind(&PrinterJobHandlerTest::MessageLoopQuitSoonHelper,
606 MessageLoop::current()),
607 base::TimeDelta::FromSeconds(1));
608
609 MessageLoop::current()->Run();
610 }
611
612 } // namespace cloud_print
613
OLDNEW
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698