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

Side by Side Diff: chrome/browser/ui/cocoa/browser/edit_search_engine_cocoa_controller_unittest.mm

Issue 10021008: Reland r131019: Move most TemplateURL data members to a new struct, TemplateURLData. This allows us… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/edit_search_engine_cocoa_controller.h" 5 #import "chrome/browser/ui/cocoa/browser/edit_search_engine_cocoa_controller.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 #include "chrome/browser/search_engines/template_url.h" 9 #include "chrome/browser/search_engines/template_url.h"
10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" 10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 // Once the URL is entered, we should have all 3 valid fields. 200 // Once the URL is entered, we should have all 3 valid fields.
201 [[controller_ urlField] setStringValue:@"http://foo-bar.com"]; 201 [[controller_ urlField] setStringValue:@"http://foo-bar.com"];
202 EXPECT_TRUE([controller_ validateFields]); 202 EXPECT_TRUE([controller_ validateFields]);
203 EXPECT_EQ([controller_ goodImage], [[controller_ urlImage] image]); 203 EXPECT_EQ([controller_ goodImage], [[controller_ urlImage] image]);
204 EXPECT_TRUE([[controller_ doneButton] isEnabled]); 204 EXPECT_TRUE([[controller_ doneButton] isEnabled]);
205 } 205 }
206 206
207 // Tests editing an existing TemplateURL. 207 // Tests editing an existing TemplateURL.
208 TEST_F(EditSearchEngineControllerTest, EditTemplateURL) { 208 TEST_F(EditSearchEngineControllerTest, EditTemplateURL) {
209 TemplateURL url; 209 TemplateURLData data;
210 url.set_short_name(ASCIIToUTF16("Foobar")); 210 data.short_name = ASCIIToUTF16("Foobar");
211 url.set_keyword(ASCIIToUTF16("keyword")); 211 data.SetKeyword(ASCIIToUTF16("keyword"));
212 std::string urlString = TemplateURLRef::DisplayURLToURLRef( 212 std::string urlString = TemplateURLRef::DisplayURLToURLRef(
213 ASCIIToUTF16("http://foo-bar.com")); 213 ASCIIToUTF16("http://foo-bar.com"));
214 url.SetURL(urlString); 214 data.SetURL(urlString);
215 TemplateURL url(data);
215 FakeEditSearchEngineController *controller = 216 FakeEditSearchEngineController *controller =
216 [[FakeEditSearchEngineController alloc] initWithProfile:profile() 217 [[FakeEditSearchEngineController alloc] initWithProfile:profile()
217 delegate:nil 218 delegate:nil
218 templateURL:&url]; 219 templateURL:&url];
219 EXPECT_TRUE([controller window]); 220 EXPECT_TRUE([controller window]);
220 NSString* title = l10n_util::GetNSString( 221 NSString* title = l10n_util::GetNSString(
221 IDS_SEARCH_ENGINES_EDITOR_EDIT_WINDOW_TITLE); 222 IDS_SEARCH_ENGINES_EDITOR_EDIT_WINDOW_TITLE);
222 EXPECT_NSEQ(title, [[controller window] title]); 223 EXPECT_NSEQ(title, [[controller window] title]);
223 NSString* nameString = [[controller nameField] stringValue]; 224 NSString* nameString = [[controller nameField] stringValue];
224 EXPECT_NSEQ(@"Foobar", nameString); 225 EXPECT_NSEQ(@"Foobar", nameString);
225 NSString* keywordString = [[controller keywordField] stringValue]; 226 NSString* keywordString = [[controller keywordField] stringValue];
226 EXPECT_NSEQ(@"keyword", keywordString); 227 EXPECT_NSEQ(@"keyword", keywordString);
227 NSString* urlValueString = [[controller urlField] stringValue]; 228 NSString* urlValueString = [[controller urlField] stringValue];
228 EXPECT_NSEQ(@"http://foo-bar.com", urlValueString); 229 EXPECT_NSEQ(@"http://foo-bar.com", urlValueString);
229 EXPECT_TRUE([controller validateFields]); 230 EXPECT_TRUE([controller validateFields]);
230 [controller close]; 231 [controller close];
231 } 232 }
232 233
233 } // namespace 234 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.cc ('k') | chrome/browser/ui/omnibox/omnibox_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698