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

Side by Side Diff: chrome/browser/browser_encoding_browsertest.cc

Issue 10409046: Migrate the rest of the "global" prefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style fixes Created 8 years, 7 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 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/scoped_temp_dir.h" 7 #include "base/scoped_temp_dir.h"
8 #include "chrome/browser/character_encoding.h" 8 #include "chrome/browser/character_encoding.h"
9 #include "chrome/browser/net/url_request_mock_util.h" 9 #include "chrome/browser/net/url_request_mock_util.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 const char* const kAutoDetectDir = "auto_detect"; 249 const char* const kAutoDetectDir = "auto_detect";
250 // Directory of the files of expected results. 250 // Directory of the files of expected results.
251 const char* const kExpectedResultDir = "expected_results"; 251 const char* const kExpectedResultDir = "expected_results";
252 252
253 FilePath test_dir_path = FilePath(kTestDir).AppendASCII(kAutoDetectDir); 253 FilePath test_dir_path = FilePath(kTestDir).AppendASCII(kAutoDetectDir);
254 254
255 // Set the default charset to one of encodings not supported by the current 255 // Set the default charset to one of encodings not supported by the current
256 // auto-detector (Please refer to the above comments) to make sure we 256 // auto-detector (Please refer to the above comments) to make sure we
257 // incorrectly decode the page. Now we use ISO-8859-4. 257 // incorrectly decode the page. Now we use ISO-8859-4.
258 browser()->profile()->GetPrefs()->SetString( 258 browser()->profile()->GetPrefs()->SetString(
259 prefs::kGlobalDefaultCharset, "ISO-8859-4"); 259 prefs::kDefaultCharset, "ISO-8859-4");
Peter Kasting 2012/05/21 21:37:20 Nit: Slightly easier to read: browser()->profil
falken 2012/05/22 02:24:21 Done.
260 260
261 content::WebContents* web_contents = browser()->GetSelectedWebContents(); 261 content::WebContents* web_contents = browser()->GetSelectedWebContents();
262 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestDatas); ++i) { 262 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestDatas); ++i) {
263 // Disable auto detect if it is on. 263 // Disable auto detect if it is on.
264 browser()->profile()->GetPrefs()->SetBoolean( 264 browser()->profile()->GetPrefs()->SetBoolean(
265 prefs::kWebKitUsesUniversalDetector, false); 265 prefs::kWebKitUsesUniversalDetector, false);
266 266
267 FilePath test_file_path(test_dir_path); 267 FilePath test_file_path(test_dir_path);
268 test_file_path = test_file_path.AppendASCII(kTestDatas[i].test_file_name); 268 test_file_path = test_file_path.AppendASCII(kTestDatas[i].test_file_name);
269 GURL url = URLRequestMockHTTPJob::GetMockUrl(test_file_path); 269 GURL url = URLRequestMockHTTPJob::GetMockUrl(test_file_path);
(...skipping 17 matching lines...) Expand all
287 EXPECT_EQ(kTestDatas[i].expected_encoding, web_contents->GetEncoding()); 287 EXPECT_EQ(kTestDatas[i].expected_encoding, web_contents->GetEncoding());
288 288
289 // Dump the page, the content of dump page should be equal with our expect 289 // Dump the page, the content of dump page should be equal with our expect
290 // result file. 290 // result file.
291 FilePath expected_result_file_name = 291 FilePath expected_result_file_name =
292 FilePath().AppendASCII(kAutoDetectDir).AppendASCII(kExpectedResultDir). 292 FilePath().AppendASCII(kAutoDetectDir).AppendASCII(kExpectedResultDir).
293 AppendASCII(kTestDatas[i].expected_result); 293 AppendASCII(kTestDatas[i].expected_result);
294 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); 294 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name);
295 } 295 }
296 } 296 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698