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

Unified Diff: chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.mm

Issue 10854150: Cocoa: Media gallery dialog unit test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
Index: chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.mm b/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.mm
index a236a0ea6360cce108d4f0f41be6b75ed9521620..1db5b6ed24cae58680816b9dd2aa9e0184b04b1a 100644
--- a/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.mm
+++ b/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.mm
@@ -94,7 +94,9 @@ MediaGalleriesDialogCocoa::MediaGalleriesDialogCocoa(
controller_->HasPermittedGalleries()];
set_sheet(alert_);
- window_ = new ConstrainedWindowMac(controller->tab_contents(), this);
+ // May be NULL during tests.
+ if (controller->tab_contents())
+ window_ = new ConstrainedWindowMac(controller->tab_contents(), this);
}
MediaGalleriesDialogCocoa::~MediaGalleriesDialogCocoa() {
@@ -125,10 +127,12 @@ void MediaGalleriesDialogCocoa::SheetDidEnd(NSInteger result) {
switch (result) {
case NSAlertFirstButtonReturn:
accepted_ = true;
- window_->CloseConstrainedWindow();
+ if (window_)
+ window_->CloseConstrainedWindow();
break;
case NSAlertSecondButtonReturn:
- window_->CloseConstrainedWindow();
+ if (window_)
+ window_->CloseConstrainedWindow();
break;
default:
NOTREACHED();

Powered by Google App Engine
This is Rietveld 408576698