OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/string16.h" | 6 #include "base/string16.h" |
7 #include "chrome/browser/printing/print_job.h" | 7 #include "chrome/browser/printing/print_job.h" |
8 #include "chrome/browser/printing/print_job_worker.h" | 8 #include "chrome/browser/printing/print_job_worker.h" |
9 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
10 #include "content/public/browser/notification_registrar.h" | 10 #include "content/public/browser/notification_registrar.h" |
11 #include "content/common/notification_service.h" | 11 #include "content/public/browser/notification_service.h" |
12 #include "printing/printed_pages_source.h" | 12 #include "printing/printed_pages_source.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 class TestSource : public printing::PrintedPagesSource { | 17 class TestSource : public printing::PrintedPagesSource { |
18 public: | 18 public: |
19 virtual string16 RenderSourceName() OVERRIDE { | 19 virtual string16 RenderSourceName() OVERRIDE { |
20 return string16(); | 20 return string16(); |
21 } | 21 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 TEST_F(PrintJobTest, MAYBE_SimplePrint) { | 94 TEST_F(PrintJobTest, MAYBE_SimplePrint) { |
95 // Test the multi-threaded nature of PrintJob to make sure we can use it with | 95 // Test the multi-threaded nature of PrintJob to make sure we can use it with |
96 // known lifetime. | 96 // known lifetime. |
97 | 97 |
98 // This message loop is actually never run. | 98 // This message loop is actually never run. |
99 MessageLoop current; | 99 MessageLoop current; |
100 | 100 |
101 content::NotificationRegistrar registrar_; | 101 content::NotificationRegistrar registrar_; |
102 TestPrintNotifObserv observ; | 102 TestPrintNotifObserv observ; |
103 registrar_.Add(&observ, content::NOTIFICATION_ALL, | 103 registrar_.Add(&observ, content::NOTIFICATION_ALL, |
104 NotificationService::AllSources()); | 104 content::NotificationService::AllSources()); |
105 volatile bool check = false; | 105 volatile bool check = false; |
106 scoped_refptr<printing::PrintJob> job(new TestPrintJob(&check)); | 106 scoped_refptr<printing::PrintJob> job(new TestPrintJob(&check)); |
107 EXPECT_EQ(MessageLoop::current(), job->message_loop()); | 107 EXPECT_EQ(MessageLoop::current(), job->message_loop()); |
108 scoped_refptr<TestOwner> owner(new TestOwner); | 108 scoped_refptr<TestOwner> owner(new TestOwner); |
109 TestSource source; | 109 TestSource source; |
110 job->Initialize(owner, &source, 1); | 110 job->Initialize(owner, &source, 1); |
111 job->Stop(); | 111 job->Stop(); |
112 job = NULL; | 112 job = NULL; |
113 EXPECT_TRUE(check); | 113 EXPECT_TRUE(check); |
114 } | 114 } |
(...skipping 22 matching lines...) Expand all Loading... |
137 job->is_job_pending(); | 137 job->is_job_pending(); |
138 job->document(); | 138 job->document(); |
139 // Private | 139 // Private |
140 job->UpdatePrintedDocument(NULL); | 140 job->UpdatePrintedDocument(NULL); |
141 scoped_refptr<printing::JobEventDetails> event_details; | 141 scoped_refptr<printing::JobEventDetails> event_details; |
142 job->OnNotifyPrintJobEvent(event_details); | 142 job->OnNotifyPrintJobEvent(event_details); |
143 job->OnDocumentDone(); | 143 job->OnDocumentDone(); |
144 job->ControlledWorkerShutdown(); | 144 job->ControlledWorkerShutdown(); |
145 */ | 145 */ |
146 } | 146 } |
OLD | NEW |