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

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

Issue 3127009: Convert infobar APIs to UTF-16. (Closed)
Patch Set: works Created 10 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 unified diff | Download patch
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_nsobject.h" 7 #include "base/scoped_nsobject.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #import "chrome/browser/cocoa/cocoa_test_helper.h" 10 #import "chrome/browser/cocoa/cocoa_test_helper.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Tests 127 // Tests
128 128
129 TEST_VIEW(AlertInfoBarControllerTest, [controller_ view]); 129 TEST_VIEW(AlertInfoBarControllerTest, [controller_ view]);
130 130
131 TEST_F(AlertInfoBarControllerTest, ShowAndDismiss) { 131 TEST_F(AlertInfoBarControllerTest, ShowAndDismiss) {
132 // Make sure someone looked at the message and icon. 132 // Make sure someone looked at the message and icon.
133 EXPECT_TRUE(delegate_.message_text_accessed); 133 EXPECT_TRUE(delegate_.message_text_accessed);
134 EXPECT_TRUE(delegate_.icon_accessed); 134 EXPECT_TRUE(delegate_.icon_accessed);
135 135
136 // Check to make sure the infobar message was set properly. 136 // Check to make sure the infobar message was set properly.
137 EXPECT_EQ(std::wstring(kMockAlertInfoBarMessage), 137 EXPECT_EQ(kMockAlertInfoBarMessage,
138 base::SysNSStringToWide([controller_.get() labelString])); 138 base::SysNSStringToUTF8([controller_.get() labelString]));
139 139
140 // Check that dismissing the infobar calls InfoBarClosed() on the delegate. 140 // Check that dismissing the infobar calls InfoBarClosed() on the delegate.
141 [controller_ dismiss:nil]; 141 [controller_ dismiss:nil];
142 EXPECT_TRUE(delegate_.closed); 142 EXPECT_TRUE(delegate_.closed);
143 } 143 }
144 144
145 TEST_F(AlertInfoBarControllerTest, DeallocController) { 145 TEST_F(AlertInfoBarControllerTest, DeallocController) {
146 // Test that dealloc'ing the controller does not send an 146 // Test that dealloc'ing the controller does not send an
147 // InfoBarClosed() message to the delegate. 147 // InfoBarClosed() message to the delegate.
148 controller_.reset(nil); 148 controller_.reset(nil);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 TEST_VIEW(ConfirmInfoBarControllerTest, [controller_ view]); 198 TEST_VIEW(ConfirmInfoBarControllerTest, [controller_ view]);
199 199
200 TEST_F(ConfirmInfoBarControllerTest, ShowAndDismiss) { 200 TEST_F(ConfirmInfoBarControllerTest, ShowAndDismiss) {
201 // Make sure someone looked at the message, link, and icon. 201 // Make sure someone looked at the message, link, and icon.
202 EXPECT_TRUE(delegate_.message_text_accessed); 202 EXPECT_TRUE(delegate_.message_text_accessed);
203 EXPECT_TRUE(delegate_.link_text_accessed); 203 EXPECT_TRUE(delegate_.link_text_accessed);
204 EXPECT_TRUE(delegate_.icon_accessed); 204 EXPECT_TRUE(delegate_.icon_accessed);
205 205
206 // Check to make sure the infobar message was set properly. 206 // Check to make sure the infobar message was set properly.
207 EXPECT_EQ(std::wstring(kMockConfirmInfoBarMessage), 207 EXPECT_EQ(kMockConfirmInfoBarMessage,
208 base::SysNSStringToWide([controller_.get() labelString])); 208 base::SysNSStringToUTF8([controller_.get() labelString]));
209 209
210 // Check that dismissing the infobar calls InfoBarClosed() on the delegate. 210 // Check that dismissing the infobar calls InfoBarClosed() on the delegate.
211 [controller_ dismiss:nil]; 211 [controller_ dismiss:nil];
212 EXPECT_FALSE(delegate_.ok_clicked); 212 EXPECT_FALSE(delegate_.ok_clicked);
213 EXPECT_FALSE(delegate_.cancel_clicked); 213 EXPECT_FALSE(delegate_.cancel_clicked);
214 EXPECT_FALSE(delegate_.link_clicked); 214 EXPECT_FALSE(delegate_.link_clicked);
215 EXPECT_TRUE(delegate_.closed); 215 EXPECT_TRUE(delegate_.closed);
216 } 216 }
217 217
218 TEST_F(ConfirmInfoBarControllerTest, ShowAndClickOK) { 218 TEST_F(ConfirmInfoBarControllerTest, ShowAndClickOK) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // Check that clicking on the link calls LinkClicked() on the 275 // Check that clicking on the link calls LinkClicked() on the
276 // delegate. It should not close the infobar. 276 // delegate. It should not close the infobar.
277 [controller_ linkClicked]; 277 [controller_ linkClicked];
278 EXPECT_FALSE(delegate_.ok_clicked); 278 EXPECT_FALSE(delegate_.ok_clicked);
279 EXPECT_FALSE(delegate_.cancel_clicked); 279 EXPECT_FALSE(delegate_.cancel_clicked);
280 EXPECT_TRUE(delegate_.link_clicked); 280 EXPECT_TRUE(delegate_.link_clicked);
281 EXPECT_FALSE(delegate_.closed); 281 EXPECT_FALSE(delegate_.closed);
282 } 282 }
283 283
284 } // namespace 284 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698