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

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

Issue 6291003: Revert 71485 - Remove wstring from TemplateURL and friends.... (Closed) Base URL: svn://svn.chromium.org/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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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 #include "app/l10n_util_mac.h" 5 #include "app/l10n_util_mac.h"
6 #include "base/scoped_nsobject.h" 6 #include "base/scoped_nsobject.h"
7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/search_engines/template_url.h" 7 #include "chrome/browser/search_engines/template_url.h"
9 #include "chrome/browser/ui/cocoa/browser_test_helper.h" 8 #include "chrome/browser/ui/cocoa/browser_test_helper.h"
10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" 9 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
11 #import "chrome/browser/ui/cocoa/edit_search_engine_cocoa_controller.h" 10 #import "chrome/browser/ui/cocoa/edit_search_engine_cocoa_controller.h"
12 #include "chrome/test/testing_profile.h" 11 #include "chrome/test/testing_profile.h"
13 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
14 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
15 #import "testing/gtest_mac.h" 14 #import "testing/gtest_mac.h"
16 #include "testing/platform_test.h" 15 #include "testing/platform_test.h"
17 16
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // Once the URL is entered, we should have all 3 valid fields. 198 // Once the URL is entered, we should have all 3 valid fields.
200 [[controller_ urlField] setStringValue:@"http://foo-bar.com"]; 199 [[controller_ urlField] setStringValue:@"http://foo-bar.com"];
201 EXPECT_TRUE([controller_ validateFields]); 200 EXPECT_TRUE([controller_ validateFields]);
202 EXPECT_EQ([controller_ goodImage], [[controller_ urlImage] image]); 201 EXPECT_EQ([controller_ goodImage], [[controller_ urlImage] image]);
203 EXPECT_TRUE([[controller_ doneButton] isEnabled]); 202 EXPECT_TRUE([[controller_ doneButton] isEnabled]);
204 } 203 }
205 204
206 // Tests editing an existing TemplateURL. 205 // Tests editing an existing TemplateURL.
207 TEST_F(EditSearchEngineControllerTest, EditTemplateURL) { 206 TEST_F(EditSearchEngineControllerTest, EditTemplateURL) {
208 TemplateURL url; 207 TemplateURL url;
209 url.set_short_name(ASCIIToUTF16("Foobar")); 208 url.set_short_name(L"Foobar");
210 url.set_keyword(ASCIIToUTF16("keyword")); 209 url.set_keyword(L"keyword");
211 std::string urlString = TemplateURLRef::DisplayURLToURLRef( 210 std::string urlString = TemplateURLRef::DisplayURLToURLRef(
212 ASCIIToUTF16("http://foo-bar.com")); 211 L"http://foo-bar.com");
213 url.SetURL(urlString, 0, 1); 212 url.SetURL(urlString, 0, 1);
214 TestingProfile* profile = browser_helper_.profile(); 213 TestingProfile* profile = browser_helper_.profile();
215 FakeEditSearchEngineController *controller = 214 FakeEditSearchEngineController *controller =
216 [[FakeEditSearchEngineController alloc] initWithProfile:profile 215 [[FakeEditSearchEngineController alloc] initWithProfile:profile
217 delegate:nil 216 delegate:nil
218 templateURL:&url]; 217 templateURL:&url];
219 EXPECT_TRUE([controller window]); 218 EXPECT_TRUE([controller window]);
220 NSString* title = l10n_util::GetNSString( 219 NSString* title = l10n_util::GetNSString(
221 IDS_SEARCH_ENGINES_EDITOR_EDIT_WINDOW_TITLE); 220 IDS_SEARCH_ENGINES_EDITOR_EDIT_WINDOW_TITLE);
222 EXPECT_NSEQ(title, [[controller window] title]); 221 EXPECT_NSEQ(title, [[controller window] title]);
223 NSString* nameString = [[controller nameField] stringValue]; 222 NSString* nameString = [[controller nameField] stringValue];
224 EXPECT_NSEQ(@"Foobar", nameString); 223 EXPECT_NSEQ(@"Foobar", nameString);
225 NSString* keywordString = [[controller keywordField] stringValue]; 224 NSString* keywordString = [[controller keywordField] stringValue];
226 EXPECT_NSEQ(@"keyword", keywordString); 225 EXPECT_NSEQ(@"keyword", keywordString);
227 NSString* urlValueString = [[controller urlField] stringValue]; 226 NSString* urlValueString = [[controller urlField] stringValue];
228 EXPECT_NSEQ(@"http://foo-bar.com", urlValueString); 227 EXPECT_NSEQ(@"http://foo-bar.com", urlValueString);
229 EXPECT_TRUE([controller validateFields]); 228 EXPECT_TRUE([controller validateFields]);
230 [controller close]; 229 [controller close];
231 } 230 }
232 231
233 } // namespace 232 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698