| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import "chrome/browser/ui/cocoa/screen_capture_notification_ui_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/screen_capture_notification_ui_cocoa.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/mac/mac_util.h" |
| 8 #include "base/macros.h" | 9 #include "base/macros.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 11 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 11 | 12 |
| 12 @interface ScreenCaptureNotificationController (ExposedForTesting) | 13 @interface ScreenCaptureNotificationController (ExposedForTesting) |
| 13 - (NSButton*)stopButton; | 14 - (NSButton*)stopButton; |
| 14 - (NSButton*)minimizeButton; | 15 - (NSButton*)minimizeButton; |
| 15 @end | 16 @end |
| 16 | 17 |
| 17 @implementation ScreenCaptureNotificationController (ExposedForTesting) | 18 @implementation ScreenCaptureNotificationController (ExposedForTesting) |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 target_->OnStarted( | 106 target_->OnStarted( |
| 106 base::Bind(&ScreenCaptureNotificationUICocoaTest::StopCallback, | 107 base::Bind(&ScreenCaptureNotificationUICocoaTest::StopCallback, |
| 107 base::Unretained(this))); | 108 base::Unretained(this))); |
| 108 | 109 |
| 109 [[controller() window] close]; | 110 [[controller() window] close]; |
| 110 | 111 |
| 111 EXPECT_EQ(1, callback_called_); | 112 EXPECT_EQ(1, callback_called_); |
| 112 } | 113 } |
| 113 | 114 |
| 114 TEST_F(ScreenCaptureNotificationUICocoaTest, MinimizeWindow) { | 115 TEST_F(ScreenCaptureNotificationUICocoaTest, MinimizeWindow) { |
| 116 if (base::mac::IsOS10_10()) |
| 117 return; // Fails when swarmed. http://crbug.com/660582 |
| 115 target_.reset( | 118 target_.reset( |
| 116 new ScreenCaptureNotificationUICocoa(base::UTF8ToUTF16("Title"))); | 119 new ScreenCaptureNotificationUICocoa(base::UTF8ToUTF16("Title"))); |
| 117 target_->OnStarted( | 120 target_->OnStarted( |
| 118 base::Bind(&ScreenCaptureNotificationUICocoaTest::StopCallback, | 121 base::Bind(&ScreenCaptureNotificationUICocoaTest::StopCallback, |
| 119 base::Unretained(this))); | 122 base::Unretained(this))); |
| 120 | 123 |
| 121 [[controller() minimizeButton] performClick:nil]; | 124 [[controller() minimizeButton] performClick:nil]; |
| 122 | 125 |
| 123 EXPECT_EQ(0, callback_called_); | 126 EXPECT_EQ(0, callback_called_); |
| 124 EXPECT_TRUE([[controller() window] isMiniaturized]); | 127 EXPECT_TRUE([[controller() window] isMiniaturized]); |
| 125 } | 128 } |
| OLD | NEW |