OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.h" | 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.h" |
10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 | 160 |
161 [controller setFolderName:@"Bozo"]; | 161 [controller setFolderName:@"Bozo"]; |
162 EXPECT_TRUE([[controller okButton] isEnabled]); | 162 EXPECT_TRUE([[controller okButton] isEnabled]); |
163 [controller setFolderName:@" "]; | 163 [controller setFolderName:@" "]; |
164 EXPECT_TRUE([[controller okButton] isEnabled]); | 164 EXPECT_TRUE([[controller okButton] isEnabled]); |
165 | 165 |
166 [controller setFolderName:@""]; | 166 [controller setFolderName:@""]; |
167 EXPECT_TRUE([[controller okButton] isEnabled]); | 167 EXPECT_TRUE([[controller okButton] isEnabled]); |
168 } | 168 } |
169 | 169 |
170 TEST_F(BookmarkNameFolderControllerTest, RemoveSingleNewLines) { | |
171 BookmarkModel* model = profile()->GetBookmarkModel(); | |
172 const BookmarkNode* parent = model->bookmark_bar_node(); | |
173 EXPECT_EQ(0, parent->child_count()); | |
174 | |
175 scoped_nsobject<BookmarkNameFolderController> | |
176 controller([[BookmarkNameFolderController alloc] | |
177 initWithParentWindow:test_window() | |
178 profile:profile() | |
179 parent:parent | |
180 newIndex:0]); | |
181 [controller window]; // force nib load | |
182 | |
183 // Add a new folder. | |
184 [controller setFolderName:@"Bozo\nThe\nClown"]; | |
185 [controller ok:nil]; | |
186 EXPECT_EQ(1, parent->child_count()); | |
187 EXPECT_TRUE(parent->GetChild(0)->is_folder()); | |
188 | |
189 // Newline is converted to a space. | |
190 EXPECT_EQ(ASCIIToUTF16("Bozo The Clown"), parent->GetChild(0)->GetTitle()); | |
191 } | |
Ilya Sherman
2011/11/22 01:18:16
It looks to me like this is simply testing the cha
| |
192 | |
193 TEST_F(BookmarkNameFolderControllerTest, RemoveMultipleNewLines) { | |
194 BookmarkModel* model = profile()->GetBookmarkModel(); | |
195 const BookmarkNode* parent = model->bookmark_bar_node(); | |
196 EXPECT_EQ(0, parent->child_count()); | |
197 | |
198 scoped_nsobject<BookmarkNameFolderController> | |
199 controller([[BookmarkNameFolderController alloc] | |
200 initWithParentWindow:test_window() | |
201 profile:profile() | |
202 parent:parent | |
203 newIndex:0]); | |
204 [controller window]; // force nib load | |
205 | |
206 // Add a new folder. | |
207 [controller setFolderName:@"Pinto\n\n\nColvig"]; | |
208 [controller ok:nil]; | |
209 EXPECT_EQ(1, parent->child_count()); | |
210 EXPECT_TRUE(parent->GetChild(0)->is_folder()); | |
211 | |
212 // Multiple newlines converted to a single space. | |
213 EXPECT_EQ(ASCIIToUTF16("Pinto Colvig"), parent->GetChild(0)->GetTitle()); | |
214 } | |
OLD | NEW |