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

Side by Side Diff: chrome/browser/translate/translate_browsertest.cc

Issue 120983002: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/infobars/infobar.h" 10 #include "chrome/browser/infobars/infobar.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 // Setup infobar observer. 136 // Setup infobar observer.
137 content::WindowedNotificationObserver infobar( 137 content::WindowedNotificationObserver infobar(
138 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, 138 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
139 content::NotificationService::AllSources()); 139 content::NotificationService::AllSources());
140 140
141 // Setup page title observer. 141 // Setup page title observer.
142 content::WebContents* web_contents = 142 content::WebContents* web_contents =
143 browser()->tab_strip_model()->GetActiveWebContents(); 143 browser()->tab_strip_model()->GetActiveWebContents();
144 ASSERT_TRUE(web_contents); 144 ASSERT_TRUE(web_contents);
145 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS")); 145 content::TitleWatcher watcher(web_contents, base::ASCIIToUTF16("PASS"));
146 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 146 watcher.AlsoWaitForTitle(base::ASCIIToUTF16("FAIL"));
147 147
148 // Visit non-secure page which is going to be translated. 148 // Visit non-secure page which is going to be translated.
149 ui_test_utils::NavigateToURL(browser(), GetNonSecureURL(kFrenchTestPath)); 149 ui_test_utils::NavigateToURL(browser(), GetNonSecureURL(kFrenchTestPath));
150 150
151 // Wait for Chrome Translate infobar. 151 // Wait for Chrome Translate infobar.
152 infobar.Wait(); 152 infobar.Wait();
153 153
154 // Perform Chrome Translate. 154 // Perform Chrome Translate.
155 translate = GetExistingTranslateInfoBarDelegate(); 155 translate = GetExistingTranslateInfoBarDelegate();
156 ASSERT_TRUE(translate); 156 ASSERT_TRUE(translate);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 198 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
199 199
200 // Check if there is no Translate infobar. 200 // Check if there is no Translate infobar.
201 TranslateInfoBarDelegate* translate = GetExistingTranslateInfoBarDelegate(); 201 TranslateInfoBarDelegate* translate = GetExistingTranslateInfoBarDelegate();
202 EXPECT_FALSE(translate); 202 EXPECT_FALSE(translate);
203 203
204 // Setup page title observer. 204 // Setup page title observer.
205 content::WebContents* web_contents = 205 content::WebContents* web_contents =
206 browser()->tab_strip_model()->GetActiveWebContents(); 206 browser()->tab_strip_model()->GetActiveWebContents();
207 ASSERT_TRUE(web_contents); 207 ASSERT_TRUE(web_contents);
208 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS")); 208 content::TitleWatcher watcher(web_contents, base::ASCIIToUTF16("PASS"));
209 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 209 watcher.AlsoWaitForTitle(base::ASCIIToUTF16("FAIL"));
210 210
211 // Visit a test page. 211 // Visit a test page.
212 ui_test_utils::NavigateToURL( 212 ui_test_utils::NavigateToURL(
213 browser(), 213 browser(),
214 GetNonSecureURL(kRefreshMetaTagTestPath)); 214 GetNonSecureURL(kRefreshMetaTagTestPath));
215 215
216 // Wait for the page title is changed after the test finished. 216 // Wait for the page title is changed after the test finished.
217 const base::string16 result = watcher.WaitAndGetTitle(); 217 const base::string16 result = watcher.WaitAndGetTitle();
218 EXPECT_EQ("PASS", UTF16ToASCII(result)); 218 EXPECT_EQ("PASS", UTF16ToASCII(result));
219 219
(...skipping 13 matching lines...) Expand all
233 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 233 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
234 234
235 // Check if there is no Translate infobar. 235 // Check if there is no Translate infobar.
236 TranslateInfoBarDelegate* translate = GetExistingTranslateInfoBarDelegate(); 236 TranslateInfoBarDelegate* translate = GetExistingTranslateInfoBarDelegate();
237 EXPECT_FALSE(translate); 237 EXPECT_FALSE(translate);
238 238
239 // Setup page title observer. 239 // Setup page title observer.
240 content::WebContents* web_contents = 240 content::WebContents* web_contents =
241 browser()->tab_strip_model()->GetActiveWebContents(); 241 browser()->tab_strip_model()->GetActiveWebContents();
242 ASSERT_TRUE(web_contents); 242 ASSERT_TRUE(web_contents);
243 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS")); 243 content::TitleWatcher watcher(web_contents, base::ASCIIToUTF16("PASS"));
244 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 244 watcher.AlsoWaitForTitle(base::ASCIIToUTF16("FAIL"));
245 245
246 // Visit a test page. 246 // Visit a test page.
247 ui_test_utils::NavigateToURL( 247 ui_test_utils::NavigateToURL(
248 browser(), 248 browser(),
249 GetNonSecureURL(kRefreshMetaTagCaseInsensitiveTestPath)); 249 GetNonSecureURL(kRefreshMetaTagCaseInsensitiveTestPath));
250 250
251 // Wait for the page title is changed after the test finished. 251 // Wait for the page title is changed after the test finished.
252 const base::string16 result = watcher.WaitAndGetTitle(); 252 const base::string16 result = watcher.WaitAndGetTitle();
253 EXPECT_EQ("PASS", UTF16ToASCII(result)); 253 EXPECT_EQ("PASS", UTF16ToASCII(result));
254 254
(...skipping 12 matching lines...) Expand all
267 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 267 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
268 268
269 // Check if there is no Translate infobar. 269 // Check if there is no Translate infobar.
270 TranslateInfoBarDelegate* translate = GetExistingTranslateInfoBarDelegate(); 270 TranslateInfoBarDelegate* translate = GetExistingTranslateInfoBarDelegate();
271 EXPECT_FALSE(translate); 271 EXPECT_FALSE(translate);
272 272
273 // Setup page title observer. 273 // Setup page title observer.
274 content::WebContents* web_contents = 274 content::WebContents* web_contents =
275 browser()->tab_strip_model()->GetActiveWebContents(); 275 browser()->tab_strip_model()->GetActiveWebContents();
276 ASSERT_TRUE(web_contents); 276 ASSERT_TRUE(web_contents);
277 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS")); 277 content::TitleWatcher watcher(web_contents, base::ASCIIToUTF16("PASS"));
278 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 278 watcher.AlsoWaitForTitle(base::ASCIIToUTF16("FAIL"));
279 279
280 // Visit a test page. 280 // Visit a test page.
281 ui_test_utils::NavigateToURL( 281 ui_test_utils::NavigateToURL(
282 browser(), 282 browser(),
283 GetNonSecureURL(kRefreshMetaTagAtOnloadTestPath)); 283 GetNonSecureURL(kRefreshMetaTagAtOnloadTestPath));
284 284
285 // Wait for the page title is changed after the test finished. 285 // Wait for the page title is changed after the test finished.
286 const base::string16 result = watcher.WaitAndGetTitle(); 286 const base::string16 result = watcher.WaitAndGetTitle();
287 EXPECT_EQ("PASS", UTF16ToASCII(result)); 287 EXPECT_EQ("PASS", UTF16ToASCII(result));
288 288
(...skipping 12 matching lines...) Expand all
301 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 301 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
302 302
303 // Check if there is no Translate infobar. 303 // Check if there is no Translate infobar.
304 TranslateInfoBarDelegate* translate = GetExistingTranslateInfoBarDelegate(); 304 TranslateInfoBarDelegate* translate = GetExistingTranslateInfoBarDelegate();
305 EXPECT_FALSE(translate); 305 EXPECT_FALSE(translate);
306 306
307 // Setup page title observer. 307 // Setup page title observer.
308 content::WebContents* web_contents = 308 content::WebContents* web_contents =
309 browser()->tab_strip_model()->GetActiveWebContents(); 309 browser()->tab_strip_model()->GetActiveWebContents();
310 ASSERT_TRUE(web_contents); 310 ASSERT_TRUE(web_contents);
311 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS")); 311 content::TitleWatcher watcher(web_contents, base::ASCIIToUTF16("PASS"));
312 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 312 watcher.AlsoWaitForTitle(base::ASCIIToUTF16("FAIL"));
313 313
314 // Visit a test page. 314 // Visit a test page.
315 ui_test_utils::NavigateToURL( 315 ui_test_utils::NavigateToURL(
316 browser(), 316 browser(),
317 GetNonSecureURL(kUpdateLocationTestPath)); 317 GetNonSecureURL(kUpdateLocationTestPath));
318 318
319 // Wait for the page title is changed after the test finished. 319 // Wait for the page title is changed after the test finished.
320 const base::string16 result = watcher.WaitAndGetTitle(); 320 const base::string16 result = watcher.WaitAndGetTitle();
321 EXPECT_EQ("PASS", UTF16ToASCII(result)); 321 EXPECT_EQ("PASS", UTF16ToASCII(result));
322 322
(...skipping 12 matching lines...) Expand all
335 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 335 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
336 336
337 // Check if there is no Translate infobar. 337 // Check if there is no Translate infobar.
338 TranslateInfoBarDelegate* translate = GetExistingTranslateInfoBarDelegate(); 338 TranslateInfoBarDelegate* translate = GetExistingTranslateInfoBarDelegate();
339 EXPECT_FALSE(translate); 339 EXPECT_FALSE(translate);
340 340
341 // Setup page title observer. 341 // Setup page title observer.
342 content::WebContents* web_contents = 342 content::WebContents* web_contents =
343 browser()->tab_strip_model()->GetActiveWebContents(); 343 browser()->tab_strip_model()->GetActiveWebContents();
344 ASSERT_TRUE(web_contents); 344 ASSERT_TRUE(web_contents);
345 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS")); 345 content::TitleWatcher watcher(web_contents, base::ASCIIToUTF16("PASS"));
346 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 346 watcher.AlsoWaitForTitle(base::ASCIIToUTF16("FAIL"));
347 347
348 // Visit a test page. 348 // Visit a test page.
349 ui_test_utils::NavigateToURL( 349 ui_test_utils::NavigateToURL(
350 browser(), 350 browser(),
351 GetNonSecureURL(kUpdateLocationAtOnloadTestPath)); 351 GetNonSecureURL(kUpdateLocationAtOnloadTestPath));
352 352
353 // Wait for the page title is changed after the test finished. 353 // Wait for the page title is changed after the test finished.
354 const base::string16 result = watcher.WaitAndGetTitle(); 354 const base::string16 result = watcher.WaitAndGetTitle();
355 EXPECT_EQ("PASS", UTF16ToASCII(result)); 355 EXPECT_EQ("PASS", UTF16ToASCII(result));
356 356
357 // Check if there is no Translate infobar. 357 // Check if there is no Translate infobar.
358 translate = GetExistingTranslateInfoBarDelegate(); 358 translate = GetExistingTranslateInfoBarDelegate();
359 EXPECT_FALSE(translate); 359 EXPECT_FALSE(translate);
360 } 360 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698