diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-18 15:41:01 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-18 15:41:01 +0000 |
commit | 8c2990ccf93794012497fe2a03291392abf400e0 (patch) | |
tree | 504c52f1901b32ee209ae0c5ae996feca4d40c32 /chrome/browser/printing/print_job.cc | |
parent | 38249475041ab3a1ca68b08670b07335c26c94d7 (diff) | |
download | chromium_src-8c2990ccf93794012497fe2a03291392abf400e0.zip chromium_src-8c2990ccf93794012497fe2a03291392abf400e0.tar.gz chromium_src-8c2990ccf93794012497fe2a03291392abf400e0.tar.bz2 |
Add superficial unit test for PrintJob. That's a start.
Add more DCHECKs.
Review URL: http://codereview.chromium.org/10957
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5607 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing/print_job.cc')
-rw-r--r-- | chrome/browser/printing/print_job.cc | 12 |
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()); |