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

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

Issue 2293373002: Remove unused prefs/api/resource for setPageEncoding (Closed)
Patch Set: It's September! Created 4 years, 3 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
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 // Set the default charset to one of encodings not supported by the current 256 // Set the default charset to one of encodings not supported by the current
257 // auto-detector (Please refer to the above comments) to make sure we 257 // auto-detector (Please refer to the above comments) to make sure we
258 // incorrectly decode the page. Now we use ISO-8859-4. 258 // incorrectly decode the page. Now we use ISO-8859-4.
259 browser()->profile()->GetPrefs()->SetString(prefs::kDefaultCharset, 259 browser()->profile()->GetPrefs()->SetString(prefs::kDefaultCharset,
260 "ISO-8859-4"); 260 "ISO-8859-4");
261 261
262 content::WebContents* web_contents = 262 content::WebContents* web_contents =
263 browser()->tab_strip_model()->GetActiveWebContents(); 263 browser()->tab_strip_model()->GetActiveWebContents();
264 for (size_t i = 0; i < arraysize(kTestDatas); ++i) { 264 for (size_t i = 0; i < arraysize(kTestDatas); ++i) {
265 // Enable auto detect.
266 browser()->profile()->GetPrefs()->SetBoolean(
267 prefs::kWebKitUsesUniversalDetector, true);
268
269 base::FilePath test_file_path(test_dir_path); 265 base::FilePath test_file_path(test_dir_path);
270 test_file_path = test_file_path.AppendASCII(kTestDatas[i].test_file_name); 266 test_file_path = test_file_path.AppendASCII(kTestDatas[i].test_file_name);
271 GURL url = 267 GURL url =
272 net::URLRequestMockHTTPJob::GetMockUrl(test_file_path.MaybeAsASCII()); 268 net::URLRequestMockHTTPJob::GetMockUrl(test_file_path.MaybeAsASCII());
273 ui_test_utils::NavigateToURL(browser(), url); 269 ui_test_utils::NavigateToURL(browser(), url);
274 270
275 // Get the encoding of page. It should return the real encoding now. 271 // Get the encoding of page. It should return the real encoding now.
276 EXPECT_EQ(kTestDatas[i].expected_encoding, web_contents->GetEncoding()); 272 EXPECT_EQ(kTestDatas[i].expected_encoding, web_contents->GetEncoding());
277 273
278 // Dump the page, the content of dump page should be equal with our expect 274 // Dump the page, the content of dump page should be equal with our expect
279 // result file. 275 // result file.
280 base::FilePath expected_result_file_name = 276 base::FilePath expected_result_file_name =
281 base::FilePath().AppendASCII(kAutoDetectDir). 277 base::FilePath().AppendASCII(kAutoDetectDir).
282 AppendASCII(kExpectedResultDir). 278 AppendASCII(kExpectedResultDir).
283 AppendASCII(kTestDatas[i].expected_result); 279 AppendASCII(kTestDatas[i].expected_result);
284 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); 280 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name);
285 } 281 }
286 } 282 }
OLDNEW
« no previous file with comments | « chrome/app/resources/locale_settings_zh-TW.xtb ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698