summaryrefslogtreecommitdiffstats
path: root/chrome/browser/printing/print_job.cc
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-25 13:47:50 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-25 13:47:50 +0000
commit27abf503d7de0fde7178f8e69fe387a27f8e1d06 (patch)
treee705a05de8c4828c259f9e6c9e1f678b97c08784 /chrome/browser/printing/print_job.cc
parent46f7efe3e8aaa8f26cf3a395a4208a6c715bb6d8 (diff)
downloadchromium_src-27abf503d7de0fde7178f8e69fe387a27f8e1d06.zip
chromium_src-27abf503d7de0fde7178f8e69fe387a27f8e1d06.tar.gz
chromium_src-27abf503d7de0fde7178f8e69fe387a27f8e1d06.tar.bz2
Add superficial unit test for PrintJob. That's a start.
Add more DCHECKs. Same as r5607 except that Thread.StopSoon is fixed. Review URL: http://codereview.chromium.org/11534 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5971 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing/print_job.cc')
-rw-r--r--chrome/browser/printing/print_job.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc
index a2d07fd..14a487cd 100644
--- a/chrome/browser/printing/print_job.cc
+++ b/chrome/browser/printing/print_job.cc
@@ -24,6 +24,8 @@ PrintJob::PrintJob(PrintedPagesSource* source)
is_job_pending_(false),
is_print_dialog_box_shown_(false),
is_canceling_(false) {
+ DCHECK(ui_message_loop_);
+ ui_message_loop_->AddDestructionObserver(this);
}
PrintJob::PrintJob()
@@ -34,14 +36,18 @@ PrintJob::PrintJob()
is_job_pending_(false),
is_print_dialog_box_shown_(false),
is_canceling_(false) {
+ DCHECK(ui_message_loop_);
+ ui_message_loop_->AddDestructionObserver(this);
}
PrintJob::~PrintJob() {
+ ui_message_loop_->RemoveDestructionObserver(this);
// The job should be finished (or at least canceled) when it is destroyed.
DCHECK(!is_job_pending_);
DCHECK(!is_print_dialog_box_shown_);
DCHECK(!is_canceling_);
- DCHECK(worker_->message_loop() == NULL);
+ if (worker_.get())
+ DCHECK(worker_->message_loop() == NULL);
DCHECK_EQ(ui_message_loop_, MessageLoop::current());
}
@@ -142,6 +148,10 @@ int PrintJob::cookie() const {
return document_->cookie();
}
+void PrintJob::WillDestroyCurrentMessageLoop() {
+ NOTREACHED();
+}
+
void PrintJob::GetSettings(GetSettingsAskParam ask_user_for_settings,
HWND parent_window) {
DCHECK_EQ(ui_message_loop_, MessageLoop::current());