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

Unified Diff: chrome/browser/printing/print_job_unittest.cc

Issue 478183005: Added PrintingContext::Delegate to get parent view handle and application locale. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mon Aug 25 23:50:54 PDT 2014 Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/printing/print_job_manager.cc ('k') | chrome/browser/printing/print_job_worker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/print_job_unittest.cc
diff --git a/chrome/browser/printing/print_job_unittest.cc b/chrome/browser/printing/print_job_unittest.cc
index 9c2d2c1e746b7b63534a98076d5b3fa83540f794..12a3dd9d50537acecef83929e638c457745e6074 100644
--- a/chrome/browser/printing/print_job_unittest.cc
+++ b/chrome/browser/printing/print_job_unittest.cc
@@ -2,13 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/printing/print_job.h"
+
#include "base/message_loop/message_loop.h"
#include "base/strings/string16.h"
#include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/printing/print_job.h"
#include "chrome/browser/printing/print_job_worker.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/common/child_process_host.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "printing/printed_pages_source.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -24,8 +27,9 @@ class TestSource : public printing::PrintedPagesSource {
class TestPrintJobWorker : public printing::PrintJobWorker {
public:
explicit TestPrintJobWorker(printing::PrintJobWorkerOwner* owner)
- : printing::PrintJobWorker(owner) {
- }
+ : printing::PrintJobWorker(content::ChildProcessHost::kInvalidUniqueID,
+ content::ChildProcessHost::kInvalidUniqueID,
+ owner) {}
friend class TestOwner;
};
@@ -82,18 +86,15 @@ class TestPrintNotifObserv : public content::NotificationObserver {
} // namespace
-typedef testing::Test PrintJobTest;
-
-TEST_F(PrintJobTest, SimplePrint) {
+TEST(PrintJobTest, SimplePrint) {
// Test the multi-threaded nature of PrintJob to make sure we can use it with
// known lifetime.
- // This message loop is actually never run.
- base::MessageLoop current;
-
+ content::TestBrowserThreadBundle thread_bundle_;
content::NotificationRegistrar registrar_;
TestPrintNotifObserv observ;
- registrar_.Add(&observ, content::NOTIFICATION_ALL,
+ registrar_.Add(&observ,
+ content::NOTIFICATION_ALL,
content::NotificationService::AllSources());
volatile bool check = false;
scoped_refptr<printing::PrintJob> job(new TestPrintJob(&check));
@@ -103,17 +104,17 @@ TEST_F(PrintJobTest, SimplePrint) {
job->Initialize(owner.get(), &source, 1);
job->Stop();
while (job->document()) {
- current.RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
}
EXPECT_FALSE(job->document());
job = NULL;
while (!check) {
- current.RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
}
EXPECT_TRUE(check);
}
-TEST_F(PrintJobTest, SimplePrintLateInit) {
+TEST(PrintJobTest, SimplePrintLateInit) {
volatile bool check = false;
base::MessageLoop current;
scoped_refptr<printing::PrintJob> job(new TestPrintJob(&check));
« no previous file with comments | « chrome/browser/printing/print_job_manager.cc ('k') | chrome/browser/printing/print_job_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698