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

Unified Diff: chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm

Issue 6262018: Cleanup:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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/infobars/infobar_controller_unittest.mm
===================================================================
--- chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm (revision 72676)
+++ chrome/browser/ui/cocoa/infobars/infobar_controller_unittest.mm (working copy)
@@ -65,25 +65,6 @@
///////////////////////////////////////////////////////////////////////////
// Test fixtures
-class AlertInfoBarControllerTest : public CocoaTest {
- public:
- virtual void SetUp() {
- CocoaTest::SetUp();
-
- controller_.reset(
- [[AlertInfoBarController alloc] initWithDelegate:&delegate_]);
- container_.reset(
- [[InfoBarContainerTest alloc] initWithController:controller_]);
- [controller_ setContainerController:container_];
- [[test_window() contentView] addSubview:[controller_ view]];
- }
-
- protected:
- MockAlertInfoBarDelegate delegate_;
- scoped_nsobject<id> container_;
- scoped_nsobject<AlertInfoBarController> controller_;
-};
-
class LinkInfoBarControllerTest : public CocoaTest {
public:
virtual void SetUp() {
@@ -126,43 +107,6 @@
////////////////////////////////////////////////////////////////////////////
// Tests
-TEST_VIEW(AlertInfoBarControllerTest, [controller_ view]);
-
-TEST_F(AlertInfoBarControllerTest, ShowAndDismiss) {
- // Make sure someone looked at the message and icon.
- EXPECT_TRUE(delegate_.message_text_accessed());
- EXPECT_TRUE(delegate_.icon_accessed());
-
- // Check to make sure the infobar message was set properly.
- EXPECT_EQ(MockAlertInfoBarDelegate::kMessage,
- base::SysNSStringToUTF8([controller_.get() labelString]));
-
- // Check that dismissing the infobar calls InfoBarClosed() on the delegate.
- [controller_ dismiss:nil];
- EXPECT_TRUE(delegate_.closed());
-}
-
-TEST_F(AlertInfoBarControllerTest, DeallocController) {
- // Test that dealloc'ing the controller does not send an
- // InfoBarClosed() message to the delegate.
- controller_.reset(nil);
- EXPECT_FALSE(delegate_.closed());
-}
-
-TEST_F(AlertInfoBarControllerTest, ResizeView) {
- NSRect originalLabelFrame = [controller_ labelFrame];
-
- // Expand the view by 20 pixels and make sure the label frame changes
- // accordingly.
- const CGFloat width = 20;
- NSRect newViewFrame = [[controller_ view] frame];
- newViewFrame.size.width += width;
- [[controller_ view] setFrame:newViewFrame];
-
- NSRect newLabelFrame = [controller_ labelFrame];
- EXPECT_EQ(NSWidth(newLabelFrame), NSWidth(originalLabelFrame) + width);
-}
-
TEST_VIEW(LinkInfoBarControllerTest, [controller_ view]);
TEST_F(LinkInfoBarControllerTest, ShowAndDismiss) {
@@ -195,6 +139,13 @@
EXPECT_FALSE(delegate_.closed());
}
+TEST_F(LinkInfoBarControllerTest, DeallocController) {
+ // Test that dealloc'ing the controller does not send an
+ // InfoBarClosed() message to the delegate.
+ controller_.reset(nil);
+ EXPECT_FALSE(delegate_.closed());
+}
+
TEST_VIEW(ConfirmInfoBarControllerTest, [controller_ view]);
TEST_F(ConfirmInfoBarControllerTest, ShowAndDismiss) {
@@ -281,4 +232,18 @@
EXPECT_FALSE(delegate_.closed());
}
+TEST_F(ConfirmInfoBarControllerTest, ResizeView) {
+ NSRect originalLabelFrame = [controller_ labelFrame];
+
+ // Expand the view by 20 pixels and make sure the label frame changes
+ // accordingly.
+ const CGFloat width = 20;
+ NSRect newViewFrame = [[controller_ view] frame];
+ newViewFrame.size.width += width;
+ [[controller_ view] setFrame:newViewFrame];
+
+ NSRect newLabelFrame = [controller_ labelFrame];
+ EXPECT_EQ(NSWidth(newLabelFrame), NSWidth(originalLabelFrame) + width);
+}
+
} // namespace
« no previous file with comments | « chrome/browser/ui/cocoa/infobars/infobar_controller.mm ('k') | chrome/browser/ui/cocoa/infobars/infobar_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698