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" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const content::NotificationSource& source, | 78 const content::NotificationSource& source, |
79 const content::NotificationDetails& details) { | 79 const content::NotificationDetails& details) { |
80 ADD_FAILURE(); | 80 ADD_FAILURE(); |
81 } | 81 } |
82 }; | 82 }; |
83 | 83 |
84 } // namespace | 84 } // namespace |
85 | 85 |
86 typedef testing::Test PrintJobTest; | 86 typedef testing::Test PrintJobTest; |
87 | 87 |
88 #if !defined(USE_AURA) | 88 // Crashes under Linux Aura, see http://crbug.com/100340 |
89 TEST_F(PrintJobTest, SimplePrint) { | 89 #if defined(USE_AURA) && !defined(OS_WIN) |
| 90 #define MAYBE_SimplePrint DISABLED_SimplePrint |
| 91 #else |
| 92 #define MAYBE_SimplePrint SimplePrint |
| 93 #endif |
| 94 TEST_F(PrintJobTest, MAYBE_SimplePrint) { |
90 // 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 |
91 // known lifetime. | 96 // known lifetime. |
92 | 97 |
93 // This message loop is actually never run. | 98 // This message loop is actually never run. |
94 MessageLoop current; | 99 MessageLoop current; |
95 | 100 |
96 content::NotificationRegistrar registrar_; | 101 content::NotificationRegistrar registrar_; |
97 TestPrintNotifObserv observ; | 102 TestPrintNotifObserv observ; |
98 registrar_.Add(&observ, content::NOTIFICATION_ALL, | 103 registrar_.Add(&observ, content::NOTIFICATION_ALL, |
99 content::NotificationService::AllSources()); | 104 content::NotificationService::AllSources()); |
100 volatile bool check = false; | 105 volatile bool check = false; |
101 scoped_refptr<printing::PrintJob> job(new TestPrintJob(&check)); | 106 scoped_refptr<printing::PrintJob> job(new TestPrintJob(&check)); |
102 EXPECT_EQ(MessageLoop::current(), job->message_loop()); | 107 EXPECT_EQ(MessageLoop::current(), job->message_loop()); |
103 scoped_refptr<TestOwner> owner(new TestOwner); | 108 scoped_refptr<TestOwner> owner(new TestOwner); |
104 TestSource source; | 109 TestSource source; |
105 job->Initialize(owner, &source, 1); | 110 job->Initialize(owner, &source, 1); |
106 job->Stop(); | 111 job->Stop(); |
107 job = NULL; | 112 job = NULL; |
108 EXPECT_TRUE(check); | 113 EXPECT_TRUE(check); |
109 } | 114 } |
110 #endif | |
111 | 115 |
112 TEST_F(PrintJobTest, SimplePrintLateInit) { | 116 TEST_F(PrintJobTest, SimplePrintLateInit) { |
113 volatile bool check = false; | 117 volatile bool check = false; |
114 MessageLoop current; | 118 MessageLoop current; |
115 scoped_refptr<printing::PrintJob> job(new TestPrintJob(&check)); | 119 scoped_refptr<printing::PrintJob> job(new TestPrintJob(&check)); |
116 job = NULL; | 120 job = NULL; |
117 EXPECT_TRUE(check); | 121 EXPECT_TRUE(check); |
118 /* TODO(maruel): Test these. | 122 /* TODO(maruel): Test these. |
119 job->Initialize() | 123 job->Initialize() |
120 job->Observe(); | 124 job->Observe(); |
(...skipping 12 matching lines...) Expand all Loading... |
133 job->is_job_pending(); | 137 job->is_job_pending(); |
134 job->document(); | 138 job->document(); |
135 // Private | 139 // Private |
136 job->UpdatePrintedDocument(NULL); | 140 job->UpdatePrintedDocument(NULL); |
137 scoped_refptr<printing::JobEventDetails> event_details; | 141 scoped_refptr<printing::JobEventDetails> event_details; |
138 job->OnNotifyPrintJobEvent(event_details); | 142 job->OnNotifyPrintJobEvent(event_details); |
139 job->OnDocumentDone(); | 143 job->OnDocumentDone(); |
140 job->ControlledWorkerShutdown(); | 144 job->ControlledWorkerShutdown(); |
141 */ | 145 */ |
142 } | 146 } |
OLD | NEW |