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

Side by Side Diff: chrome/browser/cocoa/infobar_container_controller_unittest.mm

Issue 354008: [Mac] Enables animations for the infobar.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/scoped_nsautorelease_pool.h" 7 #include "base/scoped_nsautorelease_pool.h"
8 #include "base/scoped_nsobject.h" 8 #include "base/scoped_nsobject.h"
9 #include "chrome/browser/cocoa/browser_test_helper.h" 9 #include "chrome/browser/cocoa/browser_test_helper.h"
10 #import "chrome/browser/cocoa/cocoa_test_helper.h" 10 #import "chrome/browser/cocoa/cocoa_test_helper.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 NSView* view = [controller_ view]; 56 NSView* view = [controller_ view];
57 [cocoa_helper_.contentView() addSubview:view]; 57 [cocoa_helper_.contentView() addSubview:view];
58 58
59 // Add three infobars, one of each type, and then remove them. 59 // Add three infobars, one of each type, and then remove them.
60 // After each step check to make sure we have the correct number of 60 // After each step check to make sure we have the correct number of
61 // infobar subviews. 61 // infobar subviews.
62 MockAlertInfoBarDelegate alertDelegate; 62 MockAlertInfoBarDelegate alertDelegate;
63 MockLinkInfoBarDelegate linkDelegate; 63 MockLinkInfoBarDelegate linkDelegate;
64 MockConfirmInfoBarDelegate confirmDelegate; 64 MockConfirmInfoBarDelegate confirmDelegate;
65 65
66 [controller_ addInfoBar:&alertDelegate]; 66 [controller_ addInfoBar:&alertDelegate animate:NO];
67 EXPECT_EQ(1U, [[view subviews] count]); 67 EXPECT_EQ(1U, [[view subviews] count]);
68 68
69 [controller_ addInfoBar:&linkDelegate]; 69 [controller_ addInfoBar:&linkDelegate animate:NO];
70 EXPECT_EQ(2U, [[view subviews] count]); 70 EXPECT_EQ(2U, [[view subviews] count]);
71 71
72 [controller_ addInfoBar:&confirmDelegate]; 72 [controller_ addInfoBar:&confirmDelegate animate:NO];
73 EXPECT_EQ(3U, [[view subviews] count]); 73 EXPECT_EQ(3U, [[view subviews] count]);
74 74
75 // Just to mix things up, remove them in a different order. 75 // Just to mix things up, remove them in a different order.
76 [controller_ removeInfoBarsForDelegate:&linkDelegate]; 76 [controller_ closeInfoBarsForDelegate:&linkDelegate animate:NO];
77 EXPECT_EQ(2U, [[view subviews] count]); 77 EXPECT_EQ(2U, [[view subviews] count]);
78 78
79 [controller_ removeInfoBarsForDelegate:&confirmDelegate]; 79 [controller_ closeInfoBarsForDelegate:&confirmDelegate animate:NO];
80 EXPECT_EQ(1U, [[view subviews] count]); 80 EXPECT_EQ(1U, [[view subviews] count]);
81 81
82 [controller_ removeInfoBarsForDelegate:&alertDelegate]; 82 [controller_ closeInfoBarsForDelegate:&alertDelegate animate:NO];
83 EXPECT_EQ(0U, [[view subviews] count]); 83 EXPECT_EQ(0U, [[view subviews] count]);
84 } 84 }
85 85
86 TEST_F(InfoBarContainerControllerTest, RemoveAllInfoBars) { 86 TEST_F(InfoBarContainerControllerTest, RemoveAllInfoBars) {
87 NSView* view = [controller_ view]; 87 NSView* view = [controller_ view];
88 [cocoa_helper_.contentView() addSubview:view]; 88 [cocoa_helper_.contentView() addSubview:view];
89 89
90 // Add three infobars and then remove them all. 90 // Add three infobars and then remove them all.
91 MockAlertInfoBarDelegate alertDelegate; 91 MockAlertInfoBarDelegate alertDelegate;
92 MockLinkInfoBarDelegate linkDelegate; 92 MockLinkInfoBarDelegate linkDelegate;
93 MockConfirmInfoBarDelegate confirmDelegate; 93 MockConfirmInfoBarDelegate confirmDelegate;
94 94
95 [controller_ addInfoBar:&alertDelegate]; 95 [controller_ addInfoBar:&alertDelegate animate:NO];
96 [controller_ addInfoBar:&linkDelegate]; 96 [controller_ addInfoBar:&linkDelegate animate:NO];
97 [controller_ addInfoBar:&confirmDelegate]; 97 [controller_ addInfoBar:&confirmDelegate animate:NO];
98 EXPECT_EQ(3U, [[view subviews] count]); 98 EXPECT_EQ(3U, [[view subviews] count]);
99 99
100 [controller_ removeAllInfoBars]; 100 [controller_ removeAllInfoBars];
101 EXPECT_EQ(0U, [[view subviews] count]); 101 EXPECT_EQ(0U, [[view subviews] count]);
102 } 102 }
103 } // namespace 103 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/infobar_container_controller.mm ('k') | chrome/browser/cocoa/infobar_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698