summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_encoding_uitest.cc305
-rw-r--r--chrome/browser/download/save_page_uitest.cc28
-rw-r--r--chrome/chrome.gyp1
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/Big5.html17
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/EUC-JP.html24
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/ISO-8859-13.html15
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/ISO-8859-15.html10
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/ISO-8859-2.html105
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/ISO-8859-4.html15
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/ISO-8859-5.html10
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/ISO-8859-6.html10
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/ISO-8859-7.html10
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/ISO-8859-8.html10
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/KOI8-R.html10
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/KOI8-U.html10
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/Shift-JIS.html12
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/UTF-16LE.htmlbin0 -> 956 bytes
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/UTF-8.html12
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/gb18030.html15
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/iso-8859-1.html11
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/macintosh.html10
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/windows-1250.html105
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/windows-1251.html10
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/windows-1252.html14
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/windows-1253.html10
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/windows-1254.html10
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/windows-1255.html10
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/windows-1256.html10
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/windows-1257.html23
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/windows-1258.html10
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/windows-874.html11
-rw-r--r--chrome/test/data/encoding_tests/alias_mapping/windows-949.html14
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/Big5_with_no_encoding_specified.html16
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/ISO-8859-5_with_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/ISO-8859-6_with_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/ISO-8859-7_with_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/ISO-8859-8_with_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/KOI8-R_with_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/Shift-JIS_with_no_encoding_specified.html11
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/UTF-8_with_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_Big5_saved_from_no_encoding_specified.html16
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-5_saved_from_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-6_saved_from_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-7_saved_from_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-8_saved_from_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_KOI8-R_saved_from_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_Shift-JIS_saved_from_no_encoding_specified.html11
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_UTF-8_saved_from_no_encoding_specified.html11
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_gb18030_saved_from_no_encoding_specified.html19
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_iso-8859-1_saved_from_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1251_saved_from_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1254_saved_from_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1255_saved_from_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1256_saved_from_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-949_saved_from_no_encoding_specified.html13
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/gb18030_with_no_encoding_specified.html20
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/iso-8859-1_with_no_encoding_specified.html10
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/windows-1251_with_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/windows-1254_with_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/windows-1255_with_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/windows-1256_with_no_encoding_specified.html9
-rw-r--r--chrome/test/data/encoding_tests/auto_detect/windows-949_with_no_encoding_specified.html13
-rw-r--r--chrome/test/data/encoding_tests/user_override/expected_gb18030_saved_from_iso88591_meta.html19
-rw-r--r--chrome/test/data/encoding_tests/user_override/gb18030_with_iso88591_meta.html20
-rw-r--r--chrome/test/ui/ui_test.cc53
-rw-r--r--chrome/test/ui/ui_test.h19
66 files changed, 1277 insertions, 21 deletions
diff --git a/chrome/browser/browser_encoding_uitest.cc b/chrome/browser/browser_encoding_uitest.cc
new file mode 100644
index 0000000..468cbbd
--- /dev/null
+++ b/chrome/browser/browser_encoding_uitest.cc
@@ -0,0 +1,305 @@
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+#include <string>
+
+#include "base/file_util.h"
+#include "base/path_service.h"
+#include "base/string_util.h"
+#include "chrome/browser/net/url_request_mock_http_job.h"
+#include "chrome/browser/download/save_package.h"
+#include "chrome/common/chrome_paths.h"
+#include "chrome/test/automation/automation_messages.h"
+#include "chrome/test/automation/automation_proxy.h"
+#include "chrome/test/automation/browser_proxy.h"
+#include "chrome/test/automation/tab_proxy.h"
+#include "chrome/test/ui/ui_test.h"
+#include "net/url_request/url_request_unittest.h"
+#include "chrome/common/pref_names.h"
+
+const wchar_t* const kTestDir = L"encoding_tests";
+
+class BrowserEncodingTest : public UITest {
+ protected:
+ BrowserEncodingTest() : UITest() {}
+
+ // Make sure the content of the page are as expected
+ // after override or auto-detect
+ void CheckFile(const FilePath& generated_file,
+ const FilePath& expected_result_file,
+ bool check_equal) {
+ FilePath expected_result_filepath = UITest::GetTestFilePath(
+ kTestDir, expected_result_file.ToWStringHack());
+
+ ASSERT_TRUE(file_util::PathExists(expected_result_filepath));
+ WaitForGeneratedFileAndCheck(generated_file,
+ expected_result_filepath,
+ true, // We do care whether they are equal.
+ check_equal,
+ true); // Delete the generated file when done.
+ }
+
+ virtual void SetUp() {
+ UITest::SetUp();
+ EXPECT_TRUE(file_util::CreateNewTempDirectory(L"", &save_dir_));
+ save_dir_ += FilePath::kSeparators[0];
+ }
+
+ std::wstring save_dir_;
+};
+
+// TODO(jnd): 1. Some encodings are missing here. It'll be added later. See
+// http://crbug.com/13306.
+// 2. Add more files with multiple encoding name variants for each canonical
+// encoding name). Webkit layout tests cover some, but testing in the UI test is
+// also necessary.
+TEST_F(BrowserEncodingTest, TestEncodingAliasMapping) {
+ struct EncodingTestData {
+ const wchar_t* file_name;
+ const wchar_t* encoding_name;
+ };
+
+ const EncodingTestData kEncodingTestDatas[] = {
+ { L"Big5.html", L"Big5" },
+ { L"EUC-JP.html", L"EUC-JP" },
+ { L"gb18030.html", L"gb18030" },
+ { L"iso-8859-1.html", L"ISO-8859-1" },
+ { L"ISO-8859-2.html", L"ISO-8859-2" },
+ { L"ISO-8859-4.html", L"ISO-8859-4" },
+ { L"ISO-8859-5.html", L"ISO-8859-5" },
+ { L"ISO-8859-6.html", L"ISO-8859-6" },
+ { L"ISO-8859-7.html", L"ISO-8859-7" },
+ { L"ISO-8859-8.html", L"ISO-8859-8" },
+ { L"ISO-8859-13.html", L"ISO-8859-13" },
+ { L"ISO-8859-15.html", L"ISO-8859-15" },
+ { L"KOI8-R.html", L"KOI8-R" },
+ { L"KOI8-U.html", L"KOI8-U" },
+ { L"macintosh.html", L"macintosh" },
+ { L"Shift-JIS.html", L"Shift_JIS" },
+ { L"UTF-8.html", L"UTF-8" },
+ { L"UTF-16LE.html", L"UTF-16LE" },
+ { L"windows-874.html", L"windows-874" },
+ { L"windows-949.html", L"windows-949" },
+ { L"windows-1250.html", L"windows-1250" },
+ { L"windows-1251.html", L"windows-1251" },
+ { L"windows-1252.html", L"windows-1252" },
+ { L"windows-1253.html", L"windows-1253" },
+ { L"windows-1254.html", L"windows-1254" },
+ { L"windows-1255.html", L"windows-1255" },
+ { L"windows-1256.html", L"windows-1256" },
+ { L"windows-1257.html", L"windows-1257" },
+ { L"windows-1258.html", L"windows-1258" }
+ };
+ const wchar_t* const kAliasTestDir = L"alias_mapping";
+
+ FilePath test_dir_path = FilePath::FromWStringHack(kTestDir);
+ test_dir_path = test_dir_path.Append(kAliasTestDir);
+ for (int i = 0; i < arraysize(kEncodingTestDatas); ++i) {
+ FilePath test_file_path(test_dir_path);
+ test_file_path = test_file_path.Append(kEncodingTestDatas[i].file_name);
+ GURL url =
+ URLRequestMockHTTPJob::GetMockUrl(test_file_path.ToWStringHack());
+
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
+ ASSERT_TRUE(tab_proxy.get());
+ ASSERT_TRUE(tab_proxy->NavigateToURL(url));
+ WaitUntilTabCount(1);
+
+ std::wstring encoding;
+ EXPECT_TRUE(tab_proxy->GetPageCurrentEncoding(&encoding));
+ EXPECT_EQ(encoding, kEncodingTestDatas[i].encoding_name);
+ }
+}
+
+TEST_F(BrowserEncodingTest, TestOverrideEncoding) {
+ const wchar_t* const kTestFileName =
+ L"gb18030_with_iso88591_meta.html";
+ const wchar_t* const kExpectedFileName =
+ L"expected_gb18030_saved_from_iso88591_meta.html";
+ const wchar_t* const kOverrideTestDir = L"user_override";
+
+ FilePath test_dir_path = FilePath::FromWStringHack(kTestDir);
+ test_dir_path = test_dir_path.Append(kOverrideTestDir);
+ test_dir_path = test_dir_path.Append(kTestFileName);
+ GURL url = URLRequestMockHTTPJob::GetMockUrl(test_dir_path.ToWStringHack());
+ scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
+ ASSERT_TRUE(tab_proxy.get());
+ ASSERT_TRUE(tab_proxy->NavigateToURL(url));
+ WaitUntilTabCount(1);
+
+ // Get the encoding declared in the page.
+ std::wstring encoding;
+ EXPECT_TRUE(tab_proxy->GetPageCurrentEncoding(&encoding));
+ EXPECT_EQ(encoding, L"ISO-8859-1");
+
+ // Override the encoding to "gb18030".
+ int64 last_nav_time = 0;
+ EXPECT_TRUE(tab_proxy->GetLastNavigationTime(&last_nav_time));
+ EXPECT_TRUE(tab_proxy->OverrideEncoding(L"gb18030"));
+ EXPECT_TRUE(tab_proxy->WaitForNavigation(last_nav_time));
+
+ // Re-get the encoding of page. It should be gb18030.
+ EXPECT_TRUE(tab_proxy->GetPageCurrentEncoding(&encoding));
+ EXPECT_EQ(encoding, L"gb18030");
+
+ // Dump the page, the content of dump page should be identical to the
+ // expected result file.
+ std::wstring full_file_name = save_dir_ + kTestFileName;
+ // We save the page as way of complete HTML file, which requires a directory
+ // name to save sub resources in it. Although this test file does not have
+ // sub resources, but the directory name is still required.
+ std::wstring dir = save_dir_ + L"sub_resource_files";
+ EXPECT_TRUE(tab_proxy->SavePage(full_file_name, dir,
+ SavePackage::SAVE_AS_COMPLETE_HTML));
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(browser.get());
+ EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get()));
+ FilePath expected_file_name =
+ FilePath::FromWStringHack(kOverrideTestDir);
+ expected_file_name = expected_file_name.Append(kExpectedFileName);
+ CheckFile(FilePath::FromWStringHack(full_file_name),
+ expected_file_name, true);
+}
+
+// The following encodings are excluded from the auto-detection test because
+// it's a known issue that the current encoding detector does not detect them:
+// ISO-8859-4
+// ISO-8859-13
+// KOI8-U
+// macintosh
+// windows-874
+// windows-1252
+// windows-1253
+// windows-1257
+// windows-1258
+
+// For Hebrew, the expected encoding value is ISO-8859-8-I. See
+// http://crbug.com/2927 for more details.
+TEST_F(BrowserEncodingTest, TestEncodingAutoDetect) {
+ struct EncodingAutoDetectTestData {
+ const wchar_t* test_file_name; // File name of test data.
+ const wchar_t* expected_result; // File name of expected results.
+ const wchar_t* expected_encoding; // expected encoding.
+ };
+ const EncodingAutoDetectTestData kTestDatas[] = {
+ { L"Big5_with_no_encoding_specified.html",
+ L"expected_Big5_saved_from_no_encoding_specified.html",
+ L"Big5" },
+ { L"gb18030_with_no_encoding_specified.html",
+ L"expected_gb18030_saved_from_no_encoding_specified.html",
+ L"gb18030" },
+ { L"iso-8859-1_with_no_encoding_specified.html",
+ L"expected_iso-8859-1_saved_from_no_encoding_specified.html",
+ L"ISO-8859-1" },
+ { L"ISO-8859-5_with_no_encoding_specified.html",
+ L"expected_ISO-8859-5_saved_from_no_encoding_specified.html",
+ L"ISO-8859-5" },
+ { L"ISO-8859-6_with_no_encoding_specified.html",
+ L"expected_ISO-8859-6_saved_from_no_encoding_specified.html",
+ L"ISO-8859-6" },
+ { L"ISO-8859-7_with_no_encoding_specified.html",
+ L"expected_ISO-8859-7_saved_from_no_encoding_specified.html",
+ L"ISO-8859-7" },
+ { L"ISO-8859-8_with_no_encoding_specified.html",
+ L"expected_ISO-8859-8_saved_from_no_encoding_specified.html",
+ L"ISO-8859-8-I" },
+ { L"KOI8-R_with_no_encoding_specified.html",
+ L"expected_KOI8-R_saved_from_no_encoding_specified.html",
+ L"KOI8-R" },
+ { L"Shift-JIS_with_no_encoding_specified.html",
+ L"expected_Shift-JIS_saved_from_no_encoding_specified.html",
+ L"Shift_JIS" },
+ { L"UTF-8_with_no_encoding_specified.html",
+ L"expected_UTF-8_saved_from_no_encoding_specified.html",
+ L"UTF-8" },
+ { L"windows-949_with_no_encoding_specified.html",
+ L"expected_windows-949_saved_from_no_encoding_specified.html",
+ L"windows-949" },
+ { L"windows-1251_with_no_encoding_specified.html",
+ L"expected_windows-1251_saved_from_no_encoding_specified.html",
+ L"windows-1251" },
+ { L"windows-1254_with_no_encoding_specified.html",
+ L"expected_windows-1254_saved_from_no_encoding_specified.html",
+ L"windows-1254" },
+ { L"windows-1255_with_no_encoding_specified.html",
+ L"expected_windows-1255_saved_from_no_encoding_specified.html",
+ L"windows-1255" },
+ { L"windows-1256_with_no_encoding_specified.html",
+ L"expected_windows-1256_saved_from_no_encoding_specified.html",
+ L"windows-1256" }
+ };
+ const wchar_t* const kAutoDetectDir = L"auto_detect";
+ // Directory of the files of expected results.
+ const wchar_t* const kExpectedResultDir = L"expected_results";
+
+ // Full path of saved file. full_file_name = save_dir_ + file_name[i];
+ std::wstring full_saved_file_name;
+ // Sub resource directory of saved file.
+ std::wstring tmp_save_dir(save_dir_);
+ tmp_save_dir += L"sub_resource_files";
+
+ FilePath test_dir_path = FilePath::FromWStringHack(kTestDir);
+ test_dir_path = test_dir_path.Append(kAutoDetectDir);
+
+ for (int i = 0;i < arraysize(kTestDatas);i++) {
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(browser.get());
+
+ // Set the default charset to one of encodings not supported by the current
+ // auto-detector (Please refer to the above comments) to make sure we
+ // incorrectly decode the page. Now we use ISO-8859-4.
+ browser->SetStringPreference(prefs::kDefaultCharset, L"ISO-8859-4");
+ FilePath test_file_path(test_dir_path);
+ test_file_path = test_file_path.Append(kTestDatas[i].test_file_name);
+ GURL url =
+ URLRequestMockHTTPJob::GetMockUrl(test_file_path.ToWStringHack());
+ scoped_refptr<TabProxy> tab(GetActiveTab());
+ ASSERT_TRUE(tab.get());
+ ASSERT_TRUE(tab->NavigateToURL(url));
+ WaitUntilTabCount(1);
+
+ // Disable auto detect if it is on.
+ EXPECT_TRUE(
+ browser->SetBooleanPreference(prefs::kWebKitUsesUniversalDetector,
+ false));
+ EXPECT_TRUE(tab->Reload());
+
+ // Get the encoding used for the page, it must be the default charset we
+ // just set.
+ std::wstring encoding;
+ EXPECT_TRUE(tab->GetPageCurrentEncoding(&encoding));
+ EXPECT_EQ(encoding, L"ISO-8859-4");
+
+ // Enable the encoding auto detection.
+ EXPECT_TRUE(browser->SetBooleanPreference(
+ prefs::kWebKitUsesUniversalDetector, true));
+ EXPECT_TRUE(tab->Reload());
+
+ // Re-get the encoding of page. It should return the real encoding now.
+ bool encoding_auto_detect = false;
+ EXPECT_TRUE(
+ browser->GetBooleanPreference(prefs::kWebKitUsesUniversalDetector,
+ &encoding_auto_detect));
+ EXPECT_TRUE(encoding_auto_detect);
+ EXPECT_TRUE(tab->GetPageCurrentEncoding(&encoding));
+ EXPECT_EQ(encoding, kTestDatas[i].expected_encoding);
+
+ // Dump the page, the content of dump page should be equal with our expect
+ // result file.
+ full_saved_file_name = save_dir_ + kTestDatas[i].test_file_name;
+ // Full path of expect result file.
+ FilePath expected_result_file_name =
+ FilePath::FromWStringHack(kAutoDetectDir);
+ expected_result_file_name =
+ expected_result_file_name.Append(kExpectedResultDir);
+ expected_result_file_name =
+ expected_result_file_name.Append(kTestDatas[i].expected_result);
+ EXPECT_TRUE(tab->SavePage(full_saved_file_name, tmp_save_dir,
+ SavePackage::SAVE_AS_COMPLETE_HTML));
+ EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get()));
+ CheckFile(FilePath::FromWStringHack(full_saved_file_name),
+ expected_result_file_name,
+ true);
+ }
+}
+
diff --git a/chrome/browser/download/save_page_uitest.cc b/chrome/browser/download/save_page_uitest.cc
index 0e49b46..cf21ca3 100644
--- a/chrome/browser/download/save_page_uitest.cc
+++ b/chrome/browser/download/save_page_uitest.cc
@@ -29,24 +29,16 @@ class SavePageTest : public UITest {
protected:
SavePageTest() : UITest() {}
- void CheckFile(const FilePath& client_file,
- const FilePath& server_file) {
- file_util::FileInfo previous, current;
- bool exist = false;
- for (int i = 0; i < 20; ++i) {
- if (exist) {
- file_util::GetFileInfo(client_file, &current);
- if (current.size == previous.size)
- break;
- previous = current;
- } else if (file_util::PathExists(client_file)) {
- file_util::GetFileInfo(client_file, &previous);
- exist = true;
- }
- PlatformThread::Sleep(sleep_timeout_ms());
- }
- EXPECT_TRUE(exist);
- EXPECT_TRUE(file_util::DieFileDie(client_file, false));
+ void CheckFile(const FilePath& generated_file,
+ const FilePath& expected_result_file) {
+ FilePath expected_result_filepath = UITest::GetTestFilePath(
+ UTF8ToWide(kTestDir), expected_result_file.ToWStringHack());
+ ASSERT_TRUE(file_util::PathExists(expected_result_filepath));
+ WaitForGeneratedFileAndCheck(generated_file,
+ expected_result_filepath,
+ false, // Don't care whether they are equal.
+ false,
+ false); // Don't delete file
}
virtual void SetUp() {
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index af32d9f..69d534c 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -3637,6 +3637,7 @@
],
'sources': [
'app/chrome_main_uitest.cc',
+ 'browser/browser_encoding_uitest.cc',
'browser/browser_uitest.cc',
'browser/download/download_uitest.cc',
'browser/download/save_page_uitest.cc',
diff --git a/chrome/test/data/encoding_tests/alias_mapping/Big5.html b/chrome/test/data/encoding_tests/alias_mapping/Big5.html
new file mode 100644
index 0000000..2dfa975
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/Big5.html
@@ -0,0 +1,17 @@
+<HTML>
+ <HEAD>
+ <TITLE> Big5 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=Big5" />
+ </HEAD>
+
+ <BODY>
+ 台北看守所昨天抽查前總統陳水扁的房舍,引來扁的強烈不滿。扁指所方利用他離舍會客時對他翻箱倒櫃,懷疑是來刺探他的隱私,他已透過律師向北所表達「嚴正抗議」。
+
+台北看守所昨天立即澄清,「查房」是例行公事,並未在陳水扁房內有所謂的「翻箱倒櫃」;抽查結果未發現違規物品,也未帶走任何文件,舍房內有監視器錄影,一切都有紀錄可查。
+
+北所副所長李大竹強調,為維護收容人安全,每天都會不定時、不定點抽查舍房,昨天下午抽查陳前總統舍房時,因陳水扁正與立委涂醒哲特別接見,接著馬上又是律師會見,一時來不及告知陳水扁抽查的事。
+
+律師鄭文龍則說,陳水扁抗議「查房」侵犯隱私,擔心抗辯文書會曝光或失蹤,昨天他因此不敢把書面攻防資料交給扁,避免內容曝光;他並建議阿扁十九日出庭時戴上口罩,表達「沉默抗議」,阿扁表示會考慮。
+ </BODY>
+</HTML>
+
diff --git a/chrome/test/data/encoding_tests/alias_mapping/EUC-JP.html b/chrome/test/data/encoding_tests/alias_mapping/EUC-JP.html
new file mode 100644
index 0000000..d98eb48
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/EUC-JP.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head>
+ <title>EUC-JP</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />
+</head>
+<body>
+滔竣互箔し毛仇欠仆月方丹卞鬼祭仄化中月午五卞﹜嶄莘興腔反蹣月﹝>嶸慫反嶄戔及抔日仄毛呿竣匹嗶尹化中月及井=﹝公氏卅擘互妏仇尹化五公丹分﹝
+
+﹛ㄡ慼怀懇卞反醱凝渠僅及嗯芼障梁﹜喀劂覲覦祭﹜嫖簧し洬恔嗯婁五票仆卅升﹜戲唾’滔竣覆綺互戴曰慇引木化中月﹝呾戲臍牬潟鍬反ㄠ慼怀懇﹜ㄟㄨヵ蘸芺遙午寧歹六﹜滔竣化仇ェ木及ㄢ蟾伕弗永玄及ㄡ蟾杴午匏譆尥仃月﹝
+
+﹛滔竣覆綺及优邰嶺反沓邏手ロ戶月﹝芨沓邏互狪仄寧中﹜鍍渝卞第瑁﹜嶽峏今六月及反﹜匹五卅中仇午匹反卅中反內分﹝
+
+﹛杽鎖反鍚喊ㄡ靡晚及爛喊蛟尥嗯卞丐月﹝跤抸邏互賡戶﹜爛喊蛹曖午仄化羼儒仄凶手及互﹜銑毛庍尹化怀懇卞戴曰慇引木凶﹝
+
+﹛戲唾障梁及凶戶井﹜滔竣銅瑯綺井﹝赭ぜ孺蜃毛允月及井﹜仄卅中及井﹝博彖反熬仃潸月及井﹜憮轉允月及井≡﹝潟鍬支芨邏及覆殺﹜濩抸反わ鱉趕鱉仄化五凶﹝嶄戔及刉膜獍坐楔砟吨丑
+
+﹛公及蛟尥嗯卞仇分歹勻化﹜呾戲潟鍬反芺遙及鍍渝嶽峏及し毛憤日岉介仄化仄引勻凶﹝
+
+﹛沓邏反覆瑁銑尷毛雄戶化中月﹝ㄟㄨヵ蘸芺遙副興腔尺及排黍手礞惜擗鴗膜忖豸吨丑
+
+﹛芺遙副公及手及反﹜輔情卞霜勻化ㄢㄟゥ凶化壬憤螺嶽峏允月﹝仄井仄楮洘芊副反ㄥㄟゥ互聊亢卅仃木壬蔑情匹瘋第瑁匹五卅中﹝芺遙及撕墊反內木仇戈﹝
+</body>
+</html>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-13.html b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-13.html
new file mode 100644
index 0000000..9e88f5f
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-13.html
@@ -0,0 +1,15 @@
+<HTML>
+ <HEAD>
+ <TITLE> ISO-8859-13 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-13" />
+ </HEAD>
+
+ <BODY>
+ ﹜ㄓ它夾帚型悖
+停眾斯須號獄播噶
+擱藏霰っ圴佮迓
+倳眑婭笫崷窙嗲睧
+颬睼麧緗鴇膹擨闀
+貘覷鏷禴矙
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-15.html b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-15.html
new file mode 100644
index 0000000..25ae209
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-15.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head>
+ <title>ISO-8859-15</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
+</head>
+<body>
+丹迄蜈蝨
+</body>
+</html>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-2.html b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-2.html
new file mode 100644
index 0000000..544554a
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-2.html
@@ -0,0 +1,105 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head>
+ <title>ISO-8859-2</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2" />
+</head>
+<body>
+[ ] 160 10/00 240 A0 No-break space
+[( 161 10/01 241 A1 A ogonek
+[兡 162 10/02 242 A2 Breve
+[β 163 10/03 243 A3 L with stroke
+[也 164 10/04 244 A4 Currency sign
+[包 165 10/05 245 A5 L caron
+[因 166 10/06 246 A6 S acute
+[吞 167 10/07 247 A7 Paragraph sign
+[沘 168 10/08 250 A8 Diaeresis
+[夜 169 10/09 251 A9 S caron
+[氓 170 10/10 252 AA S cedilla
+[侷 171 10/11 253 AB T caron
+[柵 172 10/12 254 AC Z acute
+[苗 173 10/13 255 AD Soft hyphen
+[孫 174 10/14 256 AE Z caron
+[珠 175 10/15 257 AF Z dot above
+[財 176 11/00 260 B0 Degree sign, ring above
+[崧 177 11/01 261 B1 a ogonek
+[淫 178 11/02 262 B2 ogonek
+[設 179 11/03 263 B3 l with stroke
+[弼 180 11/04 264 B4 Acute accent
+[琶 181 11/05 265 B5 l caron
+[跑 182 11/06 266 B6 s acute
+[愍 183 11/07 267 B7 Caron
+[窟 184 11/08 270 B8 Cedilla
+[鉛 185 11/09 271 B9 s caron
+[榜 186 11/10 272 BA s cedilla
+[蒸 187 11/11 273 BB t caron
+[奭 188 11/12 274 BC z acute
+[稽 189 11/13 275 BD Double acute accent
+[霄 190 11/14 276 BE z caron
+[瓢 191 11/15 277 BF z dot above
+[館 192 12/00 300 C0 R acute
+[縲 193 12/01 301 C1 A acute
+[擻 194 12/02 302 C2 A circumflex
+[鼕 195 12/03 303 C3 A breve
+[孃 196 12/04 304 C4 A diaeresis
+[魔 197 12/05 305 C5 L acute
+[釁 198 12/06 306 C6 C acute
+[ヅ 199 12/07 307 C7 C Cedilla
+[] 200 12/08 310 C8 C caron
+[巿 201 12/09 311 C9 E acute
+[佉 202 12/10 312 CA E ogonek
+[沎 203 12/11 313 CB E diaeresis
+[岠 204 12/12 314 CC E caron
+[狋 205 12/13 315 CD I acute
+[垚 206 12/14 316 CE I circumflex
+[柛 207 12/15 317 CF D caron
+[胅 208 13/00 320 D0 D stroke
+[娭 209 13/01 321 D1 N acute
+[涘 210 13/02 322 D2 N caron
+[罞 211 13/03 323 D3 O acute
+[偟 212 13/04 324 D4 O circumflex
+[惈 213 13/05 325 D5 O double acute
+[牻 214 13/06 326 D6 O diaeresis
+[荺 215 13/07 327 D7 Multiplication sign
+[傒 216 13/08 330 D8 R caron
+[揠 217 13/09 331 D9 U ring
+[焱 218 13/10 332 DA U acute
+[菏 219 13/11 333 DB U double acute
+[酡 220 13/12 334 DC U diaeresis
+[廅 221 13/13 335 DD Y acute
+[滘 222 13/14 336 DE T cedilla
+[絺 223 13/15 337 DF German sharp s
+[赩 224 14/00 340 E0 r acute
+[塴 225 14/01 341 E1 a acute
+[榗 226 14/02 342 E2 a circumflex
+[箂 227 14/03 343 E3 a breve
+[踃 228 14/04 344 E4 a diaeresis
+[嬁 229 14/05 345 E5 l acute
+[澕 230 14/06 346 E6 c acute
+[蓴 231 14/07 347 E7 c cedilla
+[醊 232 14/08 350 E8 c caron
+[寯 233 14/09 351 E9 e acute
+[獧 234 14/10 352 EA e ogonek
+[螗 235 14/11 353 EB e diaeresis
+[餟 236 14/12 354 EC e caron
+[燱 237 14/13 355 ED i acute
+[螬 238 14/14 356 EE i circumflex
+[駸 239 14/15 357 EF d caron
+[礑 240 15/00 360 F0 d stroke
+[鎞 241 15/01 361 F1 n acute
+[瀧 242 15/02 362 F2 n caron
+[鄿 243 15/03 363 F3 o acute
+[瀯 244 15/04 364 F4 o circumflex
+[騬 245 15/05 365 F5 o double acute
+[醹 246 15/06 366 F6 o diaeresis
+[躕 247 15/07 367 F7 Division sign
+[鱕 248 15/08 370 F8 r caron
+[鸋 249 15/09 371 F9 u ring
+[] 250 15/10 372 FA u acute
+[] 251 15/11 373 FB u double acute
+[] 252 15/12 374 FC u diaeresis
+[] 253 15/13 375 FD y acute
+[] 254 15/14 376 FE t cedilla
+[] 255 15/15 377 FF Dot above
+</body>
+</html>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-4.html b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-4.html
new file mode 100644
index 0000000..36eb7f7
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-4.html
@@ -0,0 +1,15 @@
+<HTML>
+ <HEAD>
+ <TITLE> ISO-8859-4 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-4" />
+ </HEAD>
+
+ <BODY>
+ ﹜ㄓ它夾帚型悖
+停眾斯須劃遞蝨
+擱藏霰っ圴佮迓
+倳眑婭笫崷窙嗲睧
+颬睼麧緗鴇膹擨闀
+貘覷鏷禴矙
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-5.html b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-5.html
new file mode 100644
index 0000000..a6ef5a4
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-5.html
@@ -0,0 +1,10 @@
+<HTML>
+ <HEAD>
+ <TITLE> ISO-8859-5 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-5" />
+ </HEAD>
+
+ <BODY>
+ 撫褽盒, 9 櫅 - 戲 豬砨摵. 請婭笪 楅 閛軠涷殎寊 蜍瘕崽 筄尌嵎 瘔倎趹瘑 頏摽崷摍痵 衄豝 菸頏蜄 諆雎 甀頎嵕睔崲 蹼閛嵋 葠硞 楙 睧閛眕倯嵎. 詨 葠攄觛楉 摲睙痶摵砨眓覕 嵋鬿靸剡崶 摶衴凊尰 蜮閛嵋摍睟 摵睔睚 楅 摶赻倎寊 喿笪蜙冓痽棰 嗍楉瘑雸楂痭睟 縩摲淀瘕睟 筊嗏摽尰 蜭凊畽殍 葮梊摵倷嵕殏欸 "創軗頏嗝", 痽楅筊 眙諆頏 摵倯 尌眙摵棰, 誺 種梑 葠-葮欶楙塨 摵倷嵕 瑱筊 鬿靸凄 喿槱楉軞 筊楀頏趉 豝 瘔倎趹瘑 葠 摶嗲殎寊. 濯摽崶 豇瘑眓 砨軜栳痭嵕 祒楯笪殎棰 葮淀眓楥鄳 婞 婃 楅豝 ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-6.html b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-6.html
new file mode 100644
index 0000000..b883b7b
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-6.html
@@ -0,0 +1,10 @@
+<HTML>
+ <HEAD>
+ <TITLE> ISO-8859-6 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-6" />
+ </HEAD>
+
+ <BODY dir="RTL">
+ 贊僿 蒘Ю ы婌縌 棴 ы砆 ы瑧ь ы倳р ы棑蓛 颮栜 /俜к/ 氰 獃 呬э糗 樉 杸駋 ые怀ы ы籣捚ゆ儆 槿Щ ы膱 ы极棨 摓 е ы樉й 餀 糐 鞁賙 婍ы 甃р 祴 . 魤ы ы蒘Ю 摓 糒 岓磉 摓 ы褎鳺 " э 魨 毳儆 恉軡 鳽魃糗 忴蜪 蒘Ю ы婌縌 棴 ы砆 ы瑧ь 摓 ы蚡棨 16:20 樉 щ庋ь 樉砪 縡怀 ы杸駋 ы籣捚ゆ儆耩 摓 俇 ы赸о耩 摓 糐 鞁賙 婍ы 硢 甃р 祴 " . 駍秷 ы糒 " 醱 睯 恉桾 樉 蒘Ю ы瑧ь щ庋樀 ы樉砪 襠磈 抌д 棝 樉 ы杸駋 魤 襟觰 ы樗ю矧 毲 ы睯 媎 蒯槼 駍韍 ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-7.html b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-7.html
new file mode 100644
index 0000000..d10d630
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-7.html
@@ -0,0 +1,10 @@
+<HTML>
+ <HEAD>
+ <TITLE> ISO-8859-7 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-7" />
+ </HEAD>
+
+ <BODY>
+ 极 瀌澣葐 鐋 黀 縥薀厴 豵錭摫錌 虀祼潁 鐐 巍斀 凊錆幪 忯鼥裎鶋 瀇氋錞夒鵴 鐋 僸碡殥 謥齌檷橀 鐋 黀賝 忯鼥裎鶋 蜲臄縤 蜤摐憼轕摥 鐐 巠 . 鍛椻 凊謯麎蝁. . 凊謯麎蝁 縔錼鵴 鐐蘪 摦嬿醲 罅 纈歞殦祼瀦 鏻 魦鵴澽 鐐 巠 蜒 鐐 摦厴鏻蕓, ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-8.html b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-8.html
new file mode 100644
index 0000000..3c16fa8
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/ISO-8859-8.html
@@ -0,0 +1,10 @@
+<HTML>
+ <HEAD>
+ <TITLE> ISO-8859-8 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-8" />
+ </HEAD>
+
+ <body dir="rtl">
+ 搿欒濇 擩殧 噂摋謶 蜸 撦賚匴 鍷譐 魟氆谾 檉鷿 懥鐙蠳 僓 鍣殫澬, 闃闀 鸉" 僬 襜裾: "僨 瞂齶 賟欈謮 憵 澥摥 僬 緦漦謥 懥碨 襗 馰鸄潞. 欋" 濎濋 摽瀄殣 儋濎漦 麧鳻 襗毇". 馲斁麠 麧齌 樈霟 錁 僸鼞 魟毿 闅緛 "鍷錁 儃擯 魡" 憵 灚澼 " 僤瞂謮 儰鷿" 搿欒濇 擩殧 噂摋謶 儋蜒謮-摋鳿歑 霝玃濎 襗 犪 儃擯 鍷譐 魟氆谾 魡" 僶濇 蠲馯 擩鸆 懥鐙澥 僬 僶賟鍱 暟欈譓 蟿 - 麀 暡噌澭 (') 鸆 儋霘懥, 馯樍 馲斁麠, 錁 "鍗 槴蠈擨 鍏潞 澺鸆 憵 儊錁鍱 樇 瞂齶 賟欈謮 澥摥 僬 緦漦 ...
+ </body>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/KOI8-R.html b/chrome/test/data/encoding_tests/alias_mapping/KOI8-R.html
new file mode 100644
index 0000000..97451cc
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/KOI8-R.html
@@ -0,0 +1,10 @@
+<HTML>
+ <HEAD>
+ <TITLE> KOI8-R </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=KOI8-R" />
+ </HEAD>
+
+ <BODY>
+ 臩鵻欒, 9 敆 - 襢 鎯豜衲. 轀霰秺 恔 畛祴蠱曬吇 倳婠卍 刳巟孖 婞蹉硭婘 眐衶圴蚎珌 Щ睋 樝眐俷 畷疻 埧眣尕玾劦 廱畛妅 俵佹 恓 玿畛袎賻孖. 橛 俵朒旼恌 衄珃狟衲豜袬攽 妅に眝謄奷 衃д輾圪 梖畛妅蚎珅 衲玾玴 恔 衃矬蹉吇 芶秺梉轄狦恘 迍恌婘疶恉瓬珅 嗛衄籤婠珅 冾虭衶圪 殌輾埩攪 倷鼴衲避尕攫戀 "衚硞眐芩", 狦恔冾 覂畷眐 衲賻 巟覂衲恘, 痽 輶纔 俵-倷纖恓邯 衲避尕 埡冾 に眝轂 芶蹉巟芩 冾拏眐曶 睋 婞蹉硭婘 俵 衃迓曬吇. 藲衶奷 ж婘袬 豜硨蟲瓬尕 趿挍秺曬恘 倷籤袬恄棸 儷 鰓 恔睋 ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/KOI8-U.html b/chrome/test/data/encoding_tests/alias_mapping/KOI8-U.html
new file mode 100644
index 0000000..dd7c27a9
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/KOI8-U.html
@@ -0,0 +1,10 @@
+<HTML>
+ <HEAD>
+ <TITLE> KOI8-U </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=KOI8-U" />
+ </HEAD>
+
+ <BODY>
+ 臩鵻欒, 9 敆 - 襢 鎯豜衲. 轀霰秺 恔 畛祴蠱曬吇 倳婠卍 刳巟孖 婞蹉硭婘 眐衶圴蚎珌 Щ睋 樝眐俷 畷疻 埧眣尕玾劦 廱畛妅 俵佹 恓 玿畛袎賻孖. 橛 俵朒旼恌 衄珃狟衲豜袬攽 妅に眝謄奷 衃д輾圪 梖畛妅蚎珅 衲玾玴 恔 衃矬蹉吇 芶秺梉轄狦恘 迍恌婘疶恉瓬珅 嗛衄籤婠珅 冾虭衶圪 殌輾埩攪 倷鼴衲避尕攫戀 "衚硞眐芩", 狦恔冾 覂畷眐 衲賻 巟覂衲恘, 痽 輶纔 俵-倷纖恓邯 衲避尕 埡冾 に眝轂 芶蹉巟芩 冾拏眐曶 睋 婞蹉硭婘 俵 衃迓曬吇. 藲衶奷 ж婘袬 豜硨蟲瓬尕 趿挍秺曬恘 倷籤袬恄棸 儷 鰓 恔睋 ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/Shift-JIS.html b/chrome/test/data/encoding_tests/alias_mapping/Shift-JIS.html
new file mode 100644
index 0000000..944827c
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/Shift-JIS.html
@@ -0,0 +1,12 @@
+<HTML>
+ <HEAD>
+ <TITLE> Shift_JIS </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />
+ </HEAD>
+
+ <BODY>
+ O@c@^cXAPR{cJAQ~ztQOOWNxQ\ZA@EB^}^AQ@tB}utc_s\vAQ@RcjBAts}o\A}}B
+@O@c^AO@\ZAPRQ^sBZAAyeJAztZvS~vJ@A@AB{c}A^B
+@A}XA}{Y\oJAQ(1)PRO@\Z{coAORc(2)Q@Rc|B
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/UTF-16LE.html b/chrome/test/data/encoding_tests/alias_mapping/UTF-16LE.html
new file mode 100644
index 0000000..eed43e9
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/UTF-16LE.html
Binary files differ
diff --git a/chrome/test/data/encoding_tests/alias_mapping/UTF-8.html b/chrome/test/data/encoding_tests/alias_mapping/UTF-8.html
new file mode 100644
index 0000000..7360fb6
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/UTF-8.html
@@ -0,0 +1,12 @@
+<HTML>
+ <HEAD>
+ <TITLE> UTF-8 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ </HEAD>
+
+ <BODY>
+ 暻西憭抵擃嚗喃蝙航暻阡撘.撣撌湧銋渡銵函內嚗暻西憭抵頞喳臭誑餈NBA10雿雿臬券漲銝瘨臭葉嚗隞港芸敺瘥摮韏蝚砌頧格游末蝏抬啣刻唾◤撟踹之餈瑕銝摰嗅霂蝚隡蝘唬蛹瘥手嚗蝘唬銝典箔嗅怎悌賢敺游末雿銝箔銝芸僑2000銝頞蝥抒亥秩嚗暻西隡潔撌脩憭勗颱隞憭抵摨霂亦隞撣行亦箔隞瑕潦
+
+暻西銝渲恕銝綽隞憭抵臭誑霈拐唬鈭鈭其臬嫣犖瘥韏銋嚗踵陸舐孵航秩雿舀隞祆嗅隡敹霈堆嗅芸瘥憭抵湧閬嚗隞砍憿餃芸銵
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/gb18030.html b/chrome/test/data/encoding_tests/alias_mapping/gb18030.html
new file mode 100644
index 0000000..581a4e4
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/gb18030.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+ <HEAD>
+ <TITLE> New Document </TITLE>
+ <META NAME="Generator" CONTENT="EditPlus">
+ <META NAME="Author" CONTENT="">
+ <META NAME="Keywords" CONTENT="">
+ <META NAME="Description" CONTENT="">
+ <meta http-equiv="Content-Type" content="text/html; charset=gb18030" />
+ </HEAD>
+
+ <BODY>
+ NBA夥源踏桯垓撙09爛姻儽аき恁魂雄腔論僇俶賦彆ㄛ兜擘嗣藹扲腔笢瑟齊貌肅眕2,102,368き埱鄘嚃僆屋鰷縛炸宦噬鞊寰撫桶珋堤懂腔鍰凈掛伎ㄛ苤銘著梐譟佴鳳腕狤氿珀褲啞僂1,940,162き閉埣賸褪掀懈薊襠菴媼﹝昹窒源醱ㄛ苤滄狨甡導拸褫淰祜腔柲き儂んㄛ眕1,903,798き恛懈忑弇ㄛ奧狾隴寀鳳腕1,758,499きㄛ忑楷笢瑟茼扽黨笢眳昜﹝掘忳壽蛁腔扂弊⑩埜眢膘薊婓森棒鼠票腔賦彆絞笢齬靡陲窒ヶ瑟菴弇ㄛ迵菴媼弇腔樓囀杻埱跼ㄢ16勀き腔船擒ㄛ蕉藉善蟯劦濂郔輪蠍侅騕韇蛨紫齣蝦例埮偽Ⅸ玥覺炤〥鼳ゞ牯鯕蓅稊蹎10毞腔婓盄芘き魂雄絞笢娸俵咡茩芛裒奻﹝
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/iso-8859-1.html b/chrome/test/data/encoding_tests/alias_mapping/iso-8859-1.html
new file mode 100644
index 0000000..71b9f35
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/iso-8859-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.o rg/TR/1999/REC-html401-19991224/loose.dtd">
+<HTML lang=en-US xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
+<HEAD profile=http://www.w3.org/2000/08/w3c-synd/#>
+<TITLE>World Wide Web Consortium - Web Standards</TITLE>
+<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+</HEAD>
+<BODY>
+<H1 id=logo><IMG height=48 alt="The World Wide Web Consortium (W3C)" src="/Icons/w3c_main" width=315></H1>
+<H2 id=slogan>Leading the Web to Its Full Potential...</H2>
+</BODY>
+</HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/alias_mapping/macintosh.html b/chrome/test/data/encoding_tests/alias_mapping/macintosh.html
new file mode 100644
index 0000000..4c09602
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/macintosh.html
@@ -0,0 +1,10 @@
+<HTML>
+ <HEAD>
+ <TITLE> macintosh </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=macintosh" />
+ </HEAD>
+
+ <BODY>
+ By Tom Curry Here is a guide to the process by which Gov. Rod Blagojevich of Illinois might be removed from office Impeachment is the formal accusation of wrongdoing, lobbed by a legislative body against an executive branch official, such as a governor ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/windows-1250.html b/chrome/test/data/encoding_tests/alias_mapping/windows-1250.html
new file mode 100644
index 0000000..6b7b98b
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/windows-1250.html
@@ -0,0 +1,105 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head>
+ <title>windows-1250</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
+</head>
+<body>
+[ ] 160 10/00 240 A0 No-break space
+[包 161 10/01 241 A1 A ogonek
+[兡 162 10/02 242 A2 Breve
+[β 163 10/03 243 A3 L with stroke
+[也 164 10/04 244 A4 Currency sign
+[奭 165 10/05 245 A5 L caron
+[] 166 10/06 246 A6 S acute
+[吞 167 10/07 247 A7 Paragraph sign
+[沘 168 10/08 250 A8 Diaeresis
+[] 169 10/09 251 A9 S caron
+[氓 170 10/10 252 AA S cedilla
+[] 171 10/11 253 AB T caron
+[] 172 10/12 254 AC Z acute
+[苗 173 10/13 255 AD Soft hyphen
+[] 174 10/14 256 AE Z caron
+[珠 175 10/15 257 AF Z dot above
+[財 176 11/00 260 B0 Degree sign, ring above
+[鉛 177 11/01 261 B1 a ogonek
+[淫 178 11/02 262 B2 ogonek
+[設 179 11/03 263 B3 l with stroke
+[弼 180 11/04 264 B4 Acute accent
+[霄 181 11/05 265 B5 l caron
+[] 182 11/06 266 B6 s acute
+[( 183 11/07 267 B7 Caron
+[窟 184 11/08 270 B8 Cedilla
+[] 185 11/09 271 B9 s caron
+[榜 186 11/10 272 BA s cedilla
+[] 187 11/11 273 BB t caron
+[] 188 11/12 274 BC z acute
+[稽 189 11/13 275 BD Double acute accent
+[] 190 11/14 276 BE z caron
+[瓢 191 11/15 277 BF z dot above
+[館 192 12/00 300 C0 R acute
+[縲 193 12/01 301 C1 A acute
+[擻 194 12/02 302 C2 A circumflex
+[鼕 195 12/03 303 C3 A breve
+[孃 196 12/04 304 C4 A diaeresis
+[魔 197 12/05 305 C5 L acute
+[釁 198 12/06 306 C6 C acute
+[ヅ 199 12/07 307 C7 C Cedilla
+[] 200 12/08 310 C8 C caron
+[巿 201 12/09 311 C9 E acute
+[佉 202 12/10 312 CA E ogonek
+[沎 203 12/11 313 CB E diaeresis
+[岠 204 12/12 314 CC E caron
+[狋 205 12/13 315 CD I acute
+[垚 206 12/14 316 CE I circumflex
+[柛 207 12/15 317 CF D caron
+[胅 208 13/00 320 D0 D stroke
+[娭 209 13/01 321 D1 N acute
+[涘 210 13/02 322 D2 N caron
+[罞 211 13/03 323 D3 O acute
+[偟 212 13/04 324 D4 O circumflex
+[惈 213 13/05 325 D5 O double acute
+[牻 214 13/06 326 D6 O diaeresis
+[荺 215 13/07 327 D7 Multiplication sign
+[傒 216 13/08 330 D8 R caron
+[揠 217 13/09 331 D9 U ring
+[焱 218 13/10 332 DA U acute
+[菏 219 13/11 333 DB U double acute
+[酡 220 13/12 334 DC U diaeresis
+[廅 221 13/13 335 DD Y acute
+[滘 222 13/14 336 DE T cedilla
+[絺 223 13/15 337 DF German sharp s
+[赩 224 14/00 340 E0 r acute
+[塴 225 14/01 341 E1 a acute
+[榗 226 14/02 342 E2 a circumflex
+[箂 227 14/03 343 E3 a breve
+[踃 228 14/04 344 E4 a diaeresis
+[嬁 229 14/05 345 E5 l acute
+[澕 230 14/06 346 E6 c acute
+[蓴 231 14/07 347 E7 c cedilla
+[醊 232 14/08 350 E8 c caron
+[寯 233 14/09 351 E9 e acute
+[獧 234 14/10 352 EA e ogonek
+[螗 235 14/11 353 EB e diaeresis
+[餟 236 14/12 354 EC e caron
+[燱 237 14/13 355 ED i acute
+[螬 238 14/14 356 EE i circumflex
+[駸 239 14/15 357 EF d caron
+[礑 240 15/00 360 F0 d stroke
+[鎞 241 15/01 361 F1 n acute
+[瀧 242 15/02 362 F2 n caron
+[鄿 243 15/03 363 F3 o acute
+[瀯 244 15/04 364 F4 o circumflex
+[騬 245 15/05 365 F5 o double acute
+[醹 246 15/06 366 F6 o diaeresis
+[躕 247 15/07 367 F7 Division sign
+[鱕 248 15/08 370 F8 r caron
+[鸋 249 15/09 371 F9 u ring
+[] 250 15/10 372 FA u acute
+[] 251 15/11 373 FB u double acute
+[] 252 15/12 374 FC u diaeresis
+[] 253 15/13 375 FD y acute
+[] 254 15/14 376 FE t cedilla
+[] 255 15/15 377 FF Dot above
+</body>
+</html>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/windows-1251.html b/chrome/test/data/encoding_tests/alias_mapping/windows-1251.html
new file mode 100644
index 0000000..15fac6c
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/windows-1251.html
@@ -0,0 +1,10 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-1251 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
+ </HEAD>
+
+ <BODY>
+ 旽捗臍, 9 罿 - 倞 侹碭嚦. 侲麧緛 縺 譇趜氂樇鳺 襡儗 膴鳿黓 襝鳧賥襜 豂嚭鴇齕鍏 蜬諘 靨豂瀀 灚謥 蠈貙鼏闉噮 迾譇鴈 瀁罻 翴 闀譇瞅鳪黓. 瀁碲樇噮 厴闃鍕嚦碭瘔錟 鴈鐕謽僪 勷蜱僔鳷 鵳譇鴈齕鍣 嚦闉鍙 縺 勷諙鳧鳺 懤緛鵯僦鍱膼 斁膻襜謶罾鍒鍣 膲櫇貗膼 膰擯嚭鳷 齀僔蠂樦 瀔槼嚦飶鼏槶樥 "蹴趠豂憵", 鍱縺膰 瞂灚豂 嚦鳪 鳿瞂嚦膼, 蘹 抌槻 瀁-瀔樉翴檍 嚦飶鼏 蠉膰 鐕謽僗 懤矐膻賚 膰艜豂 諘 襝鳧賥襜 瀁 勷擨樇鳺. 匎嚭 蜦襜瘔 碭賧摿鍒鼏 禖薃緛樇膼 瀔歑瘔臇 鳱 僾 縺諘 ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/windows-1252.html b/chrome/test/data/encoding_tests/alias_mapping/windows-1252.html
new file mode 100644
index 0000000..caa8a23
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/windows-1252.html
@@ -0,0 +1,14 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-1252 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
+ </HEAD>
+
+ <BODY>
+ The article of impeachment -- essentially an indictment -- now goes to the state Senate for a trial. A two-thirds vote is required there to convict Blagojevich and remove him from office. The trial will be presided over by the chief justice of the Illinois Supreme Court and could begin as early as Jan. 26.
+
+In the state Senate trial, impeachment managers and Blagojevich will have the opportunity to present witnesses and evidence.
+
+If convicted by the Illinois Senate, Blagojevich would be removed from office and Lt. Gov. Pat Quinn would become acting governor.
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/windows-1253.html b/chrome/test/data/encoding_tests/alias_mapping/windows-1253.html
new file mode 100644
index 0000000..a7fc76b
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/windows-1253.html
@@ -0,0 +1,10 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-1253 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1253" />
+ </HEAD>
+
+ <BODY>
+ 极 瀌澣葐 鐋 黀 縥薀厴 豵錭摫錌 虀祼潁 鐐 巍斀 凊錆幪 忯鼥裎鶋 瀇氋錞夒鵴 鐋 僸碡殥 謥齌檷橀 鐋 黀賝 忯鼥裎鶋 蜲臄縤 蜤摐憼轕摥 鐐 巠 . 鍛椻 凊謯麎蝁. . 凊謯麎蝁 縔錼鵴 鐐蘪 摦嬿醲 罅 纈歞殦祼瀦 鏻 魦鵴澽 鐐 巠 蜒 鐐 摦厴鏻蕓, ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/windows-1254.html b/chrome/test/data/encoding_tests/alias_mapping/windows-1254.html
new file mode 100644
index 0000000..f5da510
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/windows-1254.html
@@ -0,0 +1,10 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-1254 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1254" />
+ </HEAD>
+
+ <BODY>
+ Arama yaplan en 蓷rpc adres, AK Parti Genel Merkezi'nin karsnda yer alan ve Atatrk Orman パftli簨'nin snrlar i蓾nde yer alan Saklbah蔒 mesirelik alan. Polis ekipleri arama 蓷lmalarn Saklbah蔒'nin '蔒meba' mevkiinde yo繠nlatrld. ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/windows-1255.html b/chrome/test/data/encoding_tests/alias_mapping/windows-1255.html
new file mode 100644
index 0000000..07584f1
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/windows-1255.html
@@ -0,0 +1,10 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-1255 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1255" />
+ </HEAD>
+
+ <body dir="rtl">
+ 搿欒濇 擩殧 噂摋謶 蜸 撦賚匴 鍷譐 魟氆谾 檉鷿 懥鐙蠳 僓 鍣殫澬, 闃闀 鸉" 僬 襜裾: "僨 瞂齶 賟欈謮 憵 澥摥 僬 緦漦謥 懥碨 襗 馰鸄潞. 欋" 濎濋 摽瀄殣 儋濎漦 麧鳻 襗毇". 馲斁麠 麧齌 樈霟 錁 僸鼞 魟毿 闅緛 "鍷錁 儃擯 魡" 憵 灚澼 " 僤瞂謮 儰鷿" 搿欒濇 擩殧 噂摋謶 儋蜒謮-摋鳿歑 霝玃濎 襗 犪 儃擯 鍷譐 魟氆谾 魡" 僶濇 蠲馯 擩鸆 懥鐙澥 僬 僶賟鍱 暟欈譓 蟿 麀 暡噌澭 (') 鸆 儋霘懥, 馯樍 馲斁麠, 錁 "鍗 槴蠈擨 鍏潞 澺鸆 憵 儊錁鍱 樇 瞂齶 賟欈謮 澥摥 僬 緦漦 ...
+ </body>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/windows-1256.html b/chrome/test/data/encoding_tests/alias_mapping/windows-1256.html
new file mode 100644
index 0000000..72c6d31
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/windows-1256.html
@@ -0,0 +1,10 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-1256 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
+ </HEAD>
+
+ <BODY dir="RTL">
+ 蹼撦 萯Ю ш婍糨 祴 ш砅 ш痵ъ ш倳с ш祳葌 慴桋 /俁к/ 筀 痷 呾ы篽 蜠 杽禢 ше忯ш ш籣捚ら摿 蒑Щ ш翲 ш枃硭 楜 е ш蜠й 慺 簆 慳樇 媎ш 睕с 覗 . 箵ш ш萯Ю 楜 簁 岓韍 楜 ш樗緷 " ы 篊 筎摿 恉嵋 緛篎篽 忻蛷 萯Ю ш婍糨 祴 ш砅 ш痵ъ 楜 ш蚡硭 16:20 蜠 х庋ъ 蜠砡 簐忯 ш杽禢 ш籣捚ら摿罽 楜 俀 ш貤п罽 楜 簆 慳樇 媎ш 覘 睕с 覗 " . 磈秷 ш簁 " 邊 碔 恉桾 蜠 萯Ю ш痵ъ х庋蒘 ш蜠砡 襠鞁 戺д 硨 蜠 ш杽禢 箵 襟樠 ш蓏ь盻 筈 ш碔 婒 萩蝁 磈慲 ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/windows-1257.html b/chrome/test/data/encoding_tests/alias_mapping/windows-1257.html
new file mode 100644
index 0000000..adf4cb7
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/windows-1257.html
@@ -0,0 +1,23 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-1257 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1257" />
+ </HEAD>
+
+ <BODY>
+ ! " # $ % & ' ( ) * + , - . /
+0 1 2 3 4 5 6 7 8 9 : ; < = > ?
+@ A B C D E F G H I J K L M N O
+P Q R S T U V W X Y Z [ \ ] ^ _
+` a b c d e f g h i j k l m n o
+p q r s t u v w x y z { | } ~ 
+ ? ? ?
+ ? ? ?
+
+
+
+
+
+
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/windows-1258.html b/chrome/test/data/encoding_tests/alias_mapping/windows-1258.html
new file mode 100644
index 0000000..bb788a3
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/windows-1258.html
@@ -0,0 +1,10 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-1258 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1258" />
+ </HEAD>
+
+ <BODY>
+ L nh?ng ng?i h?c tr?, m鏮 qu d滱g t?ng th?y c trong ng輇 20/11 kh獼g ph?i l nh?ng b hoa hay nh?ng t?ng v?t v? v?t ch?t m ch璯h l s? th跣h ?t c?a h?c tr?. Nh?ng b獼g hoa t鬑 c th? t?a h鰒g th鰅 ng嫢 nhng n kh獼g th鰅 b?ng hoa 簨?m m?i. Kh獼g c l?i ca n跢 hay b?ng s? th跣h c獼g m ng?i h?c tr? k璯h d滱g l瘽 th?y. 唒 m?i l 簨?u nh?ng ng?i l跩 ngh? ?ch? ?? m?i c?m th?y h?nh phc. Th?y ? 蹥a em ?n b?n b? tri th?c m?i. Th跣h c獼g c?a em h獽 nay lu獼 c b鏮g d嫕g th?y. Th跣h c獼g h獽 c?a chng em ch璯h l th?c 繖 v? s? th跣h ?t c?a ng?i th?y.
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/windows-874.html b/chrome/test/data/encoding_tests/alias_mapping/windows-874.html
new file mode 100644
index 0000000..5813b96
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/windows-874.html
@@ -0,0 +1,11 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-874 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
+ </HEAD>
+
+ <BODY>
+ 鉬蝜椐鎳蠅鍍侜閫 謀抉嬝 鉧郯虮迡ョ弝佸挹÷瓣暽刳
+廜リ埭 :: 蓍酵冓溜轅鉲蝥 "謀抉嬝/謀抉嬝彤芧靻寢" 苂湆轄℅畟 照靾鈱砪錘蠅鍍侜閫 謀抉嬝 鞁殫僭珗a芩棸ˍ狶(漺繚荂疰迕擒晰煥﹊揤) 鉧郯俁呯扯畟菔矷疰日嘈 慞冓擋駖蒶曌湇膋樿埳鉞芤憵寧脾畛疰嗣a珔盓a芩棸煬魬佹 煤嘟蹊 苂骳岔Ж鈱褘 慞倇迡ョ
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/alias_mapping/windows-949.html b/chrome/test/data/encoding_tests/alias_mapping/windows-949.html
new file mode 100644
index 0000000..3159777
--- /dev/null
+++ b/chrome/test/data/encoding_tests/alias_mapping/windows-949.html
@@ -0,0 +1,14 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-949 </TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-949" />
+ </HEAD>
+
+ <BODY>
+ и釭塭渡擎 2錯 歜衛措蛾□ 措 頂 ァ溘ч餌 寞雖蒂 嬪и '措 ァ溘寞雖徹' 薯薑紫 蹺霞ж晦煎 ц棻.
+
+團輿渡擎 斜楝釭 "и釭塭渡檜 擊 擅撮錶 'MB學徹'擊 鬼ч 籀葬ж溥堅 п憮 斛и 渠纂 鼻鷓陛 嫦欽脹 匙擎 剪煩ж雖 彊擎 瓣 撿渡檜 ァ溘薑渡檣 曄 措團擊 ㄤ腎炾 氈棻"貊 奩嫦ц棻.
+
+歜瓣霞 匐雞識濰擎 檜陳 "措 ァ溘餌鷓諦 婦溼脹 堅模﹞堅嫦 餌勒 11勒擊 褐樓ж堅 奢薑ж啪 繹盪 熱餌ж塭"堅 雖衛ц棻. 歜 識濰擎 "措 濠徽掏擎 譆渠и 襄醞腋撿 ж雖虜, 堅模﹞堅嫦檜 氈朝 虜躑 模樓 薑渡檜釭 雖嬪 堅ж蒂 虞煩ж堅 徹婁 錳罌縑 評塭 籀葬ж塭"堅 蜓ц棻. иら 唳雞擎 鬼晦骨 團喻渡 渠ル縑啪 12橾, 團輿渡 僥з霞, 團喻渡 檜薑 曖錳縑啪朝 13橾 唳雞縑 轎戮ж塭朝 奢僥擊 陝陝 嫦歎ц棻.
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/auto_detect/Big5_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/Big5_with_no_encoding_specified.html
new file mode 100644
index 0000000..1f30b4e
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/Big5_with_no_encoding_specified.html
@@ -0,0 +1,16 @@
+<HTML>
+ <HEAD>
+ <TITLE> Big5 </TITLE>
+ </HEAD>
+
+ <BODY>
+ 台北看守所昨天抽查前總統陳水扁的房舍,引來扁的強烈不滿。扁指所方利用他離舍會客時對他翻箱倒櫃,懷疑是來刺探他的隱私,他已透過律師向北所表達「嚴正抗議」。
+
+台北看守所昨天立即澄清,「查房」是例行公事,並未在陳水扁房內有所謂的「翻箱倒櫃」;抽查結果未發現違規物品,也未帶走任何文件,舍房內有監視器錄影,一切都有紀錄可查。
+
+北所副所長李大竹強調,為維護收容人安全,每天都會不定時、不定點抽查舍房,昨天下午抽查陳前總統舍房時,因陳水扁正與立委涂醒哲特別接見,接著馬上又是律師會見,一時來不及告知陳水扁抽查的事。
+
+律師鄭文龍則說,陳水扁抗議「查房」侵犯隱私,擔心抗辯文書會曝光或失蹤,昨天他因此不敢把書面攻防資料交給扁,避免內容曝光;他並建議阿扁十九日出庭時戴上口罩,表達「沉默抗議」,阿扁表示會考慮。
+ </BODY>
+</HTML>
+
diff --git a/chrome/test/data/encoding_tests/auto_detect/ISO-8859-5_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/ISO-8859-5_with_no_encoding_specified.html
new file mode 100644
index 0000000..f5ca11e
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/ISO-8859-5_with_no_encoding_specified.html
@@ -0,0 +1,9 @@
+<HTML>
+ <HEAD>
+ <TITLE> ISO-8859-5 </TITLE>
+ </HEAD>
+
+ <BODY>
+ 撫褽盒, 9 櫅 - 戲 豬砨摵. 請婭笪 楅 閛軠涷殎寊 蜍瘕崽 筄尌嵎 瘔倎趹瘑 頏摽崷摍痵 衄豝 菸頏蜄 諆雎 甀頎嵕睔崲 蹼閛嵋 葠硞 楙 睧閛眕倯嵎. 詨 葠攄觛楉 摲睙痶摵砨眓覕 嵋鬿靸剡崶 摶衴凊尰 蜮閛嵋摍睟 摵睔睚 楅 摶赻倎寊 喿笪蜙冓痽棰 嗍楉瘑雸楂痭睟 縩摲淀瘕睟 筊嗏摽尰 蜭凊畽殍 葮梊摵倷嵕殏欸 "創軗頏嗝", 痽楅筊 眙諆頏 摵倯 尌眙摵棰, 誺 種梑 葠-葮欶楙塨 摵倷嵕 瑱筊 鬿靸凄 喿槱楉軞 筊楀頏趉 豝 瘔倎趹瘑 葠 摶嗲殎寊. 濯摽崶 豇瘑眓 砨軜栳痭嵕 祒楯笪殎棰 葮淀眓楥鄳 婞 婃 楅豝 ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/auto_detect/ISO-8859-6_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/ISO-8859-6_with_no_encoding_specified.html
new file mode 100644
index 0000000..6aad8bb
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/ISO-8859-6_with_no_encoding_specified.html
@@ -0,0 +1,9 @@
+<HTML>
+ <HEAD>
+ <TITLE> ISO-8859-6 </TITLE>
+ </HEAD>
+
+ <BODY dir="RTL">
+ 贊僿 蒘Ю ы婌縌 棴 ы砆 ы瑧ь ы倳р ы棑蓛 颮栜 /俜к/ 氰 獃 呬э糗 樉 杸駋 ые怀ы ы籣捚ゆ儆 槿Щ ы膱 ы极棨 摓 е ы樉й 餀 糐 鞁賙 婍ы 甃р 祴 . 魤ы ы蒘Ю 摓 糒 岓磉 摓 ы褎鳺 " э 魨 毳儆 恉軡 鳽魃糗 忴蜪 蒘Ю ы婌縌 棴 ы砆 ы瑧ь 摓 ы蚡棨 16:20 樉 щ庋ь 樉砪 縡怀 ы杸駋 ы籣捚ゆ儆耩 摓 俇 ы赸о耩 摓 糐 鞁賙 婍ы 硢 甃р 祴 " . 駍秷 ы糒 " 醱 睯 恉桾 樉 蒘Ю ы瑧ь щ庋樀 ы樉砪 襠磈 抌д 棝 樉 ы杸駋 魤 襟觰 ы樗ю矧 毲 ы睯 媎 蒯槼 駍韍 ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/auto_detect/ISO-8859-7_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/ISO-8859-7_with_no_encoding_specified.html
new file mode 100644
index 0000000..63a9047
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/ISO-8859-7_with_no_encoding_specified.html
@@ -0,0 +1,9 @@
+<HTML>
+ <HEAD>
+ <TITLE> ISO-8859-7 </TITLE>
+ </HEAD>
+
+ <BODY>
+ 极 瀌澣葐 鐋 黀 縥薀厴 豵錭摫錌 虀祼潁 鐐 巍斀 凊錆幪 忯鼥裎鶋 瀇氋錞夒鵴 鐋 僸碡殥 謥齌檷橀 鐋 黀賝 忯鼥裎鶋 蜲臄縤 蜤摐憼轕摥 鐐 巠 . 鍛椻 凊謯麎蝁. . 凊謯麎蝁 縔錼鵴 鐐蘪 摦嬿醲 罅 纈歞殦祼瀦 鏻 魦鵴澽 鐐 巠 蜒 鐐 摦厴鏻蕓, ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/auto_detect/ISO-8859-8_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/ISO-8859-8_with_no_encoding_specified.html
new file mode 100644
index 0000000..4a4e467
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/ISO-8859-8_with_no_encoding_specified.html
@@ -0,0 +1,9 @@
+<HTML>
+ <HEAD>
+ <TITLE> ISO-8859-8 </TITLE>
+ </HEAD>
+
+ <body dir="rtl">
+ 搿欒濇 擩殧 噂摋謶 蜸 撦賚匴 鍷譐 魟氆谾 檉鷿 懥鐙蠳 僓 鍣殫澬, 闃闀 鸉" 僬 襜裾: "僨 瞂齶 賟欈謮 憵 澥摥 僬 緦漦謥 懥碨 襗 馰鸄潞. 欋" 濎濋 摽瀄殣 儋濎漦 麧鳻 襗毇". 馲斁麠 麧齌 樈霟 錁 僸鼞 魟毿 闅緛 "鍷錁 儃擯 魡" 憵 灚澼 " 僤瞂謮 儰鷿" 搿欒濇 擩殧 噂摋謶 儋蜒謮-摋鳿歑 霝玃濎 襗 犪 儃擯 鍷譐 魟氆谾 魡" 僶濇 蠲馯 擩鸆 懥鐙澥 僬 僶賟鍱 暟欈譓 蟿 - 麀 暡噌澭 (') 鸆 儋霘懥, 馯樍 馲斁麠, 錁 "鍗 槴蠈擨 鍏潞 澺鸆 憵 儊錁鍱 樇 瞂齶 賟欈謮 澥摥 僬 緦漦 ...
+ </body>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/auto_detect/KOI8-R_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/KOI8-R_with_no_encoding_specified.html
new file mode 100644
index 0000000..13c81c9
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/KOI8-R_with_no_encoding_specified.html
@@ -0,0 +1,9 @@
+<HTML>
+ <HEAD>
+ <TITLE> KOI8-R </TITLE>
+ </HEAD>
+
+ <BODY>
+ 臩鵻欒, 9 敆 - 襢 鎯豜衲. 轀霰秺 恔 畛祴蠱曬吇 倳婠卍 刳巟孖 婞蹉硭婘 眐衶圴蚎珌 Щ睋 樝眐俷 畷疻 埧眣尕玾劦 廱畛妅 俵佹 恓 玿畛袎賻孖. 橛 俵朒旼恌 衄珃狟衲豜袬攽 妅に眝謄奷 衃д輾圪 梖畛妅蚎珅 衲玾玴 恔 衃矬蹉吇 芶秺梉轄狦恘 迍恌婘疶恉瓬珅 嗛衄籤婠珅 冾虭衶圪 殌輾埩攪 倷鼴衲避尕攫戀 "衚硞眐芩", 狦恔冾 覂畷眐 衲賻 巟覂衲恘, 痽 輶纔 俵-倷纖恓邯 衲避尕 埡冾 に眝轂 芶蹉巟芩 冾拏眐曶 睋 婞蹉硭婘 俵 衃迓曬吇. 藲衶奷 ж婘袬 豜硨蟲瓬尕 趿挍秺曬恘 倷籤袬恄棸 儷 鰓 恔睋 ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/auto_detect/Shift-JIS_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/Shift-JIS_with_no_encoding_specified.html
new file mode 100644
index 0000000..63d5852
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/Shift-JIS_with_no_encoding_specified.html
@@ -0,0 +1,11 @@
+<HTML>
+ <HEAD>
+ <TITLE> Shift_JIS </TITLE>
+ </HEAD>
+
+ <BODY>
+ O@c@^cXAPR{cJAQ~ztQOOWNxQ\ZA@EB^}^AQ@tB}utc_s\vAQ@RcjBAts}o\A}}B
+@O@c^AO@\ZAPRQ^sBZAAyeJAztZvS~vJ@A@AB{c}A^B
+@A}XA}{Y\oJAQ(1)PRO@\Z{coAORc(2)Q@Rc|B
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/auto_detect/UTF-8_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/UTF-8_with_no_encoding_specified.html
new file mode 100644
index 0000000..65537cb
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/UTF-8_with_no_encoding_specified.html
@@ -0,0 +1,9 @@
+<HTML><HEAD>
+ <TITLE> UTF-8 </TITLE>
+ </HEAD><BODY>
+ 暻西憭抵擃嚗喃蝙航暻阡撘.撣撌湧銋渡銵函內嚗暻西憭抵頞喳臭誑餈NBA10雿雿臬券漲銝瘨臭葉嚗隞港芸敺瘥摮韏蝚砌頧格游末蝏抬啣刻唾◤撟踹之餈瑕銝摰嗅霂蝚隡蝘唬蛹瘥手嚗蝘唬銝典箔嗅怎悌賢敺游末雿銝箔銝芸僑2000銝頞蝥抒亥秩嚗暻西隡潔撌脩憭勗颱隞憭抵摨霂亦隞撣行亦箔隞瑕潦
+
+暻西銝渲恕銝綽隞憭抵臭誑霈拐唬鈭鈭其臬嫣犖瘥韏銋嚗踵陸舐孵航秩雿舀隞祆嗅隡敹霈堆嗅芸瘥憭抵湧閬嚗隞砍憿餃芸銵
+
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_Big5_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_Big5_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..c1da48d
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_Big5_saved_from_no_encoding_specified.html
@@ -0,0 +1,16 @@
+
+<!-- saved from url=(0080)http://mock.http/encoding_tests/auto_detect/Big5_with_no_encoding_specified.html -->
+<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=Big5">
+ <TITLE> Big5 </TITLE>
+ </HEAD><BODY>
+ 台北看守所昨天抽查前總統陳水扁的房舍,引來扁的強烈不滿。扁指所方利用他離舍會客時對他翻箱倒櫃,懷疑是來刺探他的隱私,他已透過律師向北所表達「嚴正抗議」。
+
+台北看守所昨天立即澄清,「查房」是例行公事,並未在陳水扁房內有所謂的「翻箱倒櫃」;抽查結果未發現違規物品,也未帶走任何文件,舍房內有監視器錄影,一切都有紀錄可查。
+
+北所副所長李大竹強調,為維護收容人安全,每天都會不定時、不定點抽查舍房,昨天下午抽查陳前總統舍房時,因陳水扁正與立委涂醒哲特別接見,接著馬上又是律師會見,一時來不及告知陳水扁抽查的事。
+
+律師鄭文龍則說,陳水扁抗議「查房」侵犯隱私,擔心抗辯文書會曝光或失蹤,昨天他因此不敢把書面攻防資料交給扁,避免內容曝光;他並建議阿扁十九日出庭時戴上口罩,表達「沉默抗議」,阿扁表示會考慮。
+
+
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-5_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-5_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..bd58e79
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-5_saved_from_no_encoding_specified.html
@@ -0,0 +1,9 @@
+
+<!-- saved from url=(0086)http://mock.http/encoding_tests/auto_detect/ISO-8859-5_with_no_encoding_specified.html -->
+<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-5">
+ <TITLE> ISO-8859-5 </TITLE>
+ </HEAD><BODY>
+ 撫褽盒, 9 櫅 - 戲 豬砨摵. 請婭笪 楅 閛軠涷殎寊 蜍瘕崽 筄尌嵎 瘔倎趹瘑 頏摽崷摍痵 衄豝 菸頏蜄 諆雎 甀頎嵕睔崲 蹼閛嵋 葠硞 楙 睧閛眕倯嵎. 詨 葠攄觛楉 摲睙痶摵砨眓覕 嵋鬿靸剡崶 摶衴凊尰 蜮閛嵋摍睟 摵睔睚 楅 摶赻倎寊 喿笪蜙冓痽棰 嗍楉瘑雸楂痭睟 縩摲淀瘕睟 筊嗏摽尰 蜭凊畽殍 葮梊摵倷嵕殏欸 "創軗頏嗝", 痽楅筊 眙諆頏 摵倯 尌眙摵棰, 誺 種梑 葠-葮欶楙塨 摵倷嵕 瑱筊 鬿靸凄 喿槱楉軞 筊楀頏趉 豝 瘔倎趹瘑 葠 摶嗲殎寊. 濯摽崶 豇瘑眓 砨軜栳痭嵕 祒楯笪殎棰 葮淀眓楥鄳 婞 婃 楅豝 ...
+
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-6_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-6_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..04c6dc1
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-6_saved_from_no_encoding_specified.html
@@ -0,0 +1,9 @@
+
+<!-- saved from url=(0086)http://mock.http/encoding_tests/auto_detect/ISO-8859-6_with_no_encoding_specified.html -->
+<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-6">
+ <TITLE> ISO-8859-6 </TITLE>
+ </HEAD><BODY dir="RTL">
+ 贊僿 蒘Ю ы婌縌 棴 ы砆 ы瑧ь ы倳р ы棑蓛 颮栜 /俜к/ 氰 獃 呬э糗 樉 杸駋 ые怀ы ы籣捚ゆ儆 槿Щ ы膱 ы极棨 摓 е ы樉й 餀 糐 鞁賙 婍ы 甃р 祴 . 魤ы ы蒘Ю 摓 糒 岓磉 摓 ы褎鳺 " э 魨 毳儆 恉軡 鳽魃糗 忴蜪 蒘Ю ы婌縌 棴 ы砆 ы瑧ь 摓 ы蚡棨 16:20 樉 щ庋ь 樉砪 縡怀 ы杸駋 ы籣捚ゆ儆耩 摓 俇 ы赸о耩 摓 糐 鞁賙 婍ы 硢 甃р 祴 " . 駍秷 ы糒 " 醱 睯 恉桾 樉 蒘Ю ы瑧ь щ庋樀 ы樉砪 襠磈 抌д 棝 樉 ы杸駋 魤 襟觰 ы樗ю矧 毲 ы睯 媎 蒯槼 駍韍 ...
+
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-7_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-7_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..21be47b
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-7_saved_from_no_encoding_specified.html
@@ -0,0 +1,9 @@
+
+<!-- saved from url=(0086)http://mock.http/encoding_tests/auto_detect/ISO-8859-7_with_no_encoding_specified.html -->
+<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-7">
+ <TITLE> ISO-8859-7 </TITLE>
+ </HEAD><BODY>
+ 极 瀌澣葐 鐋 黀 縥薀厴 豵錭摫錌 虀祼潁 鐐 巍斀 凊錆幪 忯鼥裎鶋 瀇氋錞夒鵴 鐋 僸碡殥 謥齌檷橀 鐋 黀賝 忯鼥裎鶋 蜲臄縤 蜤摐憼轕摥 鐐 巠 . 鍛椻 凊謯麎蝁. . 凊謯麎蝁 縔錼鵴 鐐蘪 摦嬿醲 罅 纈歞殦祼瀦 鏻 魦鵴澽 鐐 巠 蜒 鐐 摦厴鏻蕓, ...
+
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-8_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-8_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..cc921aef
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_ISO-8859-8_saved_from_no_encoding_specified.html
@@ -0,0 +1,9 @@
+
+<!-- saved from url=(0086)http://mock.http/encoding_tests/auto_detect/ISO-8859-8_with_no_encoding_specified.html -->
+<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-8-I">
+ <TITLE> ISO-8859-8 </TITLE>
+ </HEAD><BODY dir="rtl">
+ 搿欒濇 擩殧 噂摋謶 蜸 撦賚匴 鍷譐 魟氆谾 檉鷿 懥鐙蠳 僓 鍣殫澬, 闃闀 鸉" 僬 襜裾: "僨 瞂齶 賟欈謮 憵 澥摥 僬 緦漦謥 懥碨 襗 馰鸄潞. 欋" 濎濋 摽瀄殣 儋濎漦 麧鳻 襗毇". 馲斁麠 麧齌 樈霟 錁 僸鼞 魟毿 闅緛 "鍷錁 儃擯 魡" 憵 灚澼 " 僤瞂謮 儰鷿" 搿欒濇 擩殧 噂摋謶 儋蜒謮-摋鳿歑 霝玃濎 襗 犪 儃擯 鍷譐 魟氆谾 魡" 僶濇 蠲馯 擩鸆 懥鐙澥 僬 僶賟鍱 暟欈譓 蟿 - 麀 暡噌澭 (') 鸆 儋霘懥, 馯樍 馲斁麠, 錁 "鍗 槴蠈擨 鍏潞 澺鸆 憵 儊錁鍱 樇 瞂齶 賟欈謮 澥摥 僬 緦漦 ...
+
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_KOI8-R_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_KOI8-R_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..8a66d34
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_KOI8-R_saved_from_no_encoding_specified.html
@@ -0,0 +1,9 @@
+
+<!-- saved from url=(0082)http://mock.http/encoding_tests/auto_detect/KOI8-R_with_no_encoding_specified.html -->
+<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=KOI8-R">
+ <TITLE> KOI8-R </TITLE>
+ </HEAD><BODY>
+ 臩鵻欒, 9 敆 - 襢 鎯豜衲. 轀霰秺 恔 畛祴蠱曬吇 倳婠卍 刳巟孖 婞蹉硭婘 眐衶圴蚎珌 Щ睋 樝眐俷 畷疻 埧眣尕玾劦 廱畛妅 俵佹 恓 玿畛袎賻孖. 橛 俵朒旼恌 衄珃狟衲豜袬攽 妅に眝謄奷 衃д輾圪 梖畛妅蚎珅 衲玾玴 恔 衃矬蹉吇 芶秺梉轄狦恘 迍恌婘疶恉瓬珅 嗛衄籤婠珅 冾虭衶圪 殌輾埩攪 倷鼴衲避尕攫戀 "衚硞眐芩", 狦恔冾 覂畷眐 衲賻 巟覂衲恘, 痽 輶纔 俵-倷纖恓邯 衲避尕 埡冾 に眝轂 芶蹉巟芩 冾拏眐曶 睋 婞蹉硭婘 俵 衃迓曬吇. 藲衶奷 ж婘袬 豜硨蟲瓬尕 趿挍秺曬恘 倷籤袬恄棸 儷 鰓 恔睋 ...
+
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_Shift-JIS_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_Shift-JIS_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..2a0d5b1
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_Shift-JIS_saved_from_no_encoding_specified.html
@@ -0,0 +1,11 @@
+
+<!-- saved from url=(0085)http://mock.http/encoding_tests/auto_detect/Shift-JIS_with_no_encoding_specified.html -->
+<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
+ <TITLE> Shift_JIS </TITLE>
+ </HEAD><BODY>
+ O@c@^cXAPR{cJAQ~ztQOOWNxQ\ZA@EB^}^AQ@tB}utc_s\vAQ@RcjBAts}o\A}}B
+@O@c^AO@\ZAPRQ^sBZAAyeJAztZvS~vJ@A@AB{c}A^B
+@A}XA}{Y\oJAQ(1)PRO@\Z{coAORc(2)Q@Rc|B
+
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_UTF-8_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_UTF-8_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..b76be7a
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_UTF-8_saved_from_no_encoding_specified.html
@@ -0,0 +1,11 @@
+
+<!-- saved from url=(0081)http://mock.http/encoding_tests/auto_detect/UTF-8_with_no_encoding_specified.html -->
+<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <TITLE> UTF-8 </TITLE>
+ </HEAD><BODY>
+ 暻西憭抵擃嚗喃蝙航暻阡撘.撣撌湧銋渡銵函內嚗暻西憭抵頞喳臭誑餈NBA10雿雿臬券漲銝瘨臭葉嚗隞港芸敺瘥摮韏蝚砌頧格游末蝏抬啣刻唾◤撟踹之餈瑕銝摰嗅霂蝚隡蝘唬蛹瘥手嚗蝘唬銝典箔嗅怎悌賢敺游末雿銝箔銝芸僑2000銝頞蝥抒亥秩嚗暻西隡潔撌脩憭勗颱隞憭抵摨霂亦隞撣行亦箔隞瑕潦
+
+暻西銝渲恕銝綽隞憭抵臭誑霈拐唬鈭鈭其臬嫣犖瘥韏銋嚗踵陸舐孵航秩雿舀隞祆嗅隡敹霈堆嗅芸瘥憭抵湧閬嚗隞砍憿餃芸銵
+
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_gb18030_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_gb18030_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..f7625ed
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_gb18030_saved_from_no_encoding_specified.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0083)http://mock.http/encoding_tests/auto_detect/gb18030_with_no_encoding_specified.html -->
+<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><META http-equiv="Content-Type" content="text/html; charset=gb18030">
+<TITLE>笢弊秶婖腔鍰濂氪3靡</TITLE>
+</HEAD><BODY>
+笢弊秶婖腔鍰濂氪3靡˙
+
+鎮倓艞盆邿瑤毞褪撮摩芶鼠侗軞冪燴ㄛ蚚鍔岍賜涾儐腔瑤毞※笢弊厒僅§ㄛ鎮倓蟙げ胱邿瑤毞輛輲姪桸倜萯探˙
+
+燠岍禍ㄛ湮昄痄雄籵陓扢掘衄癹鼠侗詢撰撮扲嘈恀ㄛ坻掩備峈笢弊腔TD眳虜ㄛ峈賸TD腔袧汜ㄛ坻澭儕賠藉ㄛ2008爛菁ㄛ籣湮腔3G呏栯笝衾嶺羲湮躉˙
+
+睡砅翩ㄛ藝腔摩芶雁岈擁翋炟ㄛ坻眕Ч熒腔珛憎崝酗ㄛ湮忒捩腔彶劃ㄛ倯擔※啞萇眳卼§惘釱ㄛ婓室羷蟭睆挨巘苺皆婐邿腔赻翋こ齪欄瑞滄栨˙
+
+懂赻恅趙斐砩莉珛腔緊恁2靡˙
+
+勀豎ㄛ捇荻わ珛摩芶衄癹鼠侗雁岈酗ㄛ坻斐婖俶蔚換苀荂芃珛迵珋測IT撮扲俇藝睆洷皈痡珈楷隴荂芃扲900嗣爛綴ㄛ坻峈荂芃扲腔嘟盺笭陔荇腕賸蝨偭睿郬旆˙
+
+澈すㄛ笢弊萇荌摩芶鼠侗雁岈酗ㄛ植▲拸憤◎﹜▲芘靡袨◎善▲喪族◎﹜▲繩擘滂◎ㄛ蚕澈す鍰絳腔笢荌芶勦妏笢弊萇荌羲宎輛貐圴黖譬鬷畎探˙
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_iso-8859-1_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_iso-8859-1_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..2917cfe
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_iso-8859-1_saved_from_no_encoding_specified.html
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.o rg/TR/1999/REC-html401-19991224/loose.dtd">
+<!-- saved from url=(0086)http://mock.http/encoding_tests/auto_detect/iso-8859-1_with_no_encoding_specified.html -->
+<HTML lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml"><HEAD profile="http://www.w3.org/2000/08/w3c-synd/#"><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<TITLE>iso-8859-1</TITLE>
+</HEAD><BODY>
+<H1 id="logo"><IMG height="48" alt="The World Wide Web Consortium (W3C)" src="http://mock.http/Icons/w3c_main" width="315"></H1>
+<H2 id="slogan">Leading the Web to Its Full Potential...</H2>
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1251_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1251_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..39f0513
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1251_saved_from_no_encoding_specified.html
@@ -0,0 +1,9 @@
+
+<!-- saved from url=(0088)http://mock.http/encoding_tests/auto_detect/windows-1251_with_no_encoding_specified.html -->
+<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=windows-1251">
+ <TITLE> windows-1251 </TITLE>
+ </HEAD><BODY>
+ 旽捗臍, 9 罿 - 倞 侹碭嚦. 侲麧緛 縺 譇趜氂樇鳺 襡儗 膴鳿黓 襝鳧賥襜 豂嚭鴇齕鍏 蜬諘 靨豂瀀 灚謥 蠈貙鼏闉噮 迾譇鴈 瀁罻 翴 闀譇瞅鳪黓. 瀁碲樇噮 厴闃鍕嚦碭瘔錟 鴈鐕謽僪 勷蜱僔鳷 鵳譇鴈齕鍣 嚦闉鍙 縺 勷諙鳧鳺 懤緛鵯僦鍱膼 斁膻襜謶罾鍒鍣 膲櫇貗膼 膰擯嚭鳷 齀僔蠂樦 瀔槼嚦飶鼏槶樥 "蹴趠豂憵", 鍱縺膰 瞂灚豂 嚦鳪 鳿瞂嚦膼, 蘹 抌槻 瀁-瀔樉翴檍 嚦飶鼏 蠉膰 鐕謽僗 懤矐膻賚 膰艜豂 諘 襝鳧賥襜 瀁 勷擨樇鳺. 匎嚭 蜦襜瘔 碭賧摿鍒鼏 禖薃緛樇膼 瀔歑瘔臇 鳱 僾 縺諘 ...
+
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1254_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1254_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..7a44240
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1254_saved_from_no_encoding_specified.html
@@ -0,0 +1,9 @@
+
+<!-- saved from url=(0088)http://mock.http/encoding_tests/auto_detect/windows-1254_with_no_encoding_specified.html -->
+<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=windows-1254">
+ <TITLE> windows-1254 </TITLE>
+ </HEAD><BODY>
+ Arama yaplan en 蓷rpc adres, AK Parti Genel Merkezi'nin karsnda yer alan ve Atatrk Orman パftli簨'nin snrlar i蓾nde yer alan Saklbah蔒 mesirelik alan. Polis ekipleri arama 蓷lmalarn Saklbah蔒'nin '蔒meba' mevkiinde yo繠nlatrld. ...
+
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1255_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1255_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..adeb491
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1255_saved_from_no_encoding_specified.html
@@ -0,0 +1,9 @@
+
+<!-- saved from url=(0088)http://mock.http/encoding_tests/auto_detect/windows-1255_with_no_encoding_specified.html -->
+<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=windows-1255">
+ <TITLE> windows-1255 </TITLE>
+ </HEAD><BODY dir="rtl">
+ 搿欒濇 擩殧 噂摋謶 蜸 撦賚匴 鍷譐 魟氆谾 檉鷿 懥鐙蠳 僓 鍣殫澬, 闃闀 鸉" 僬 襜裾: "僨 瞂齶 賟欈謮 憵 澥摥 僬 緦漦謥 懥碨 襗 馰鸄潞. 欋" 濎濋 摽瀄殣 儋濎漦 麧鳻 襗毇". 馲斁麠 麧齌 樈霟 錁 僸鼞 魟毿 闅緛 "鍷錁 儃擯 魡" 憵 灚澼 " 僤瞂謮 儰鷿" 搿欒濇 擩殧 噂摋謶 儋蜒謮-摋鳿歑 霝玃濎 襗 犪 儃擯 鍷譐 魟氆谾 魡" 僶濇 蠲馯 擩鸆 懥鐙澥 僬 僶賟鍱 暟欈譓 蟿 麀 暡噌澭 (') 鸆 儋霘懥, 馯樍 馲斁麠, 錁 "鍗 槴蠈擨 鍏潞 澺鸆 憵 儊錁鍱 樇 瞂齶 賟欈謮 澥摥 僬 緦漦 ...
+
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1256_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1256_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..d145318
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-1256_saved_from_no_encoding_specified.html
@@ -0,0 +1,9 @@
+
+<!-- saved from url=(0088)http://mock.http/encoding_tests/auto_detect/windows-1256_with_no_encoding_specified.html -->
+<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=windows-1256">
+ <TITLE> windows-1256 </TITLE>
+ </HEAD><BODY dir="RTL">
+ 蹼撦 萯Ю ш婍糨 祴 ш砅 ш痵ъ ш倳с ш祳葌 慴桋 /俁к/ 筀 痷 呾ы篽 蜠 杽禢 ше忯ш ш籣捚ら摿 蒑Щ ш翲 ш枃硭 楜 е ш蜠й 慺 簆 慳樇 媎ш 睕с 覗 . 箵ш ш萯Ю 楜 簁 岓韍 楜 ш樗緷 " ы 篊 筎摿 恉嵋 緛篎篽 忻蛷 萯Ю ш婍糨 祴 ш砅 ш痵ъ 楜 ш蚡硭 16:20 蜠 х庋ъ 蜠砡 簐忯 ш杽禢 ш籣捚ら摿罽 楜 俀 ш貤п罽 楜 簆 慳樇 媎ш 覘 睕с 覗 " . 磈秷 ш簁 " 邊 碔 恉桾 蜠 萯Ю ш痵ъ х庋蒘 ш蜠砡 襠鞁 戺д 硨 蜠 ш杽禢 箵 襟樠 ш蓏ь盻 筈 ш碔 婒 萩蝁 磈慲 ...
+
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-949_saved_from_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-949_saved_from_no_encoding_specified.html
new file mode 100644
index 0000000..6d3ddcf2
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/expected_results/expected_windows-949_saved_from_no_encoding_specified.html
@@ -0,0 +1,13 @@
+
+<!-- saved from url=(0087)http://mock.http/encoding_tests/auto_detect/windows-949_with_no_encoding_specified.html -->
+<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=windows-949">
+ <TITLE> windows-949 </TITLE>
+ </HEAD><BODY>
+ и釭塭渡擎 2錯 歜衛措蛾□ 措 頂 ァ溘ч餌 寞雖蒂 嬪и '措 ァ溘寞雖徹' 薯薑紫 蹺霞ж晦煎 ц棻.
+
+團輿渡擎 斜楝釭 "и釭塭渡檜 擊 擅撮錶 'MB學徹'擊 鬼ч 籀葬ж溥堅 п憮 斛и 渠纂 鼻鷓陛 嫦欽脹 匙擎 剪煩ж雖 彊擎 瓣 撿渡檜 ァ溘薑渡檣 曄 措團擊 ㄤ腎炾 氈棻"貊 奩嫦ц棻.
+
+歜瓣霞 匐雞識濰擎 檜陳 "措 ァ溘餌鷓諦 婦溼脹 堅模﹞堅嫦 餌勒 11勒擊 褐樓ж堅 奢薑ж啪 繹盪 熱餌ж塭"堅 雖衛ц棻. 歜 識濰擎 "措 濠徽掏擎 譆渠и 襄醞腋撿 ж雖虜, 堅模﹞堅嫦檜 氈朝 虜躑 模樓 薑渡檜釭 雖嬪 堅ж蒂 虞煩ж堅 徹婁 錳罌縑 評塭 籀葬ж塭"堅 蜓ц棻. иら 唳雞擎 鬼晦骨 團喻渡 渠ル縑啪 12橾, 團輿渡 僥з霞, 團喻渡 檜薑 曖錳縑啪朝 13橾 唳雞縑 轎戮ж塭朝 奢僥擊 陝陝 嫦歎ц棻.
+
+
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/gb18030_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/gb18030_with_no_encoding_specified.html
new file mode 100644
index 0000000..fb9dfbf
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/gb18030_with_no_encoding_specified.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0023)http://www.sina.com.cn/ -->
+<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD>
+<TITLE>笢弊秶婖腔鍰濂氪3靡</TITLE>
+</HEAD>
+<BODY>
+笢弊秶婖腔鍰濂氪3靡˙
+
+鎮倓艞盆邿瑤毞褪撮摩芶鼠侗軞冪燴ㄛ蚚鍔岍賜涾儐腔瑤毞※笢弊厒僅§ㄛ鎮倓蟙げ胱邿瑤毞輛輲姪桸倜萯探˙
+
+燠岍禍ㄛ湮昄痄雄籵陓扢掘衄癹鼠侗詢撰撮扲嘈恀ㄛ坻掩備峈笢弊腔TD眳虜ㄛ峈賸TD腔袧汜ㄛ坻澭儕賠藉ㄛ2008爛菁ㄛ籣湮腔3G呏栯笝衾嶺羲湮躉˙
+
+睡砅翩ㄛ藝腔摩芶雁岈擁翋炟ㄛ坻眕Ч熒腔珛憎崝酗ㄛ湮忒捩腔彶劃ㄛ倯擔※啞萇眳卼§惘釱ㄛ婓室羷蟭睆挨巘苺皆婐邿腔赻翋こ齪欄瑞滄栨˙
+
+懂赻恅趙斐砩莉珛腔緊恁2靡˙
+
+勀豎ㄛ捇荻わ珛摩芶衄癹鼠侗雁岈酗ㄛ坻斐婖俶蔚換苀荂芃珛迵珋測IT撮扲俇藝睆洷皈痡珈楷隴荂芃扲900嗣爛綴ㄛ坻峈荂芃扲腔嘟盺笭陔荇腕賸蝨偭睿郬旆˙
+
+澈すㄛ笢弊萇荌摩芶鼠侗雁岈酗ㄛ植▲拸憤◎﹜▲芘靡袨◎善▲喪族◎﹜▲繩擘滂◎ㄛ蚕澈す鍰絳腔笢荌芶勦妏笢弊萇荌羲宎輛貐圴黖譬鬷畎探˙
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/iso-8859-1_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/iso-8859-1_with_no_encoding_specified.html
new file mode 100644
index 0000000..17571c9
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/iso-8859-1_with_no_encoding_specified.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.o rg/TR/1999/REC-html401-19991224/loose.dtd">
+<HTML lang=en-US xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
+<HEAD profile=http://www.w3.org/2000/08/w3c-synd/#>
+<TITLE>iso-8859-1</TITLE>
+</HEAD>
+<BODY>
+<H1 id=logo><IMG height=48 alt="The World Wide Web Consortium (W3C)" src="/Icons/w3c_main" width=315></H1>
+<H2 id=slogan>Leading the Web to Its Full Potential...</H2>
+</BODY>
+</HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/auto_detect/windows-1251_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/windows-1251_with_no_encoding_specified.html
new file mode 100644
index 0000000..436da4d
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/windows-1251_with_no_encoding_specified.html
@@ -0,0 +1,9 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-1251 </TITLE>
+ </HEAD>
+
+ <BODY>
+ 旽捗臍, 9 罿 - 倞 侹碭嚦. 侲麧緛 縺 譇趜氂樇鳺 襡儗 膴鳿黓 襝鳧賥襜 豂嚭鴇齕鍏 蜬諘 靨豂瀀 灚謥 蠈貙鼏闉噮 迾譇鴈 瀁罻 翴 闀譇瞅鳪黓. 瀁碲樇噮 厴闃鍕嚦碭瘔錟 鴈鐕謽僪 勷蜱僔鳷 鵳譇鴈齕鍣 嚦闉鍙 縺 勷諙鳧鳺 懤緛鵯僦鍱膼 斁膻襜謶罾鍒鍣 膲櫇貗膼 膰擯嚭鳷 齀僔蠂樦 瀔槼嚦飶鼏槶樥 "蹴趠豂憵", 鍱縺膰 瞂灚豂 嚦鳪 鳿瞂嚦膼, 蘹 抌槻 瀁-瀔樉翴檍 嚦飶鼏 蠉膰 鐕謽僗 懤矐膻賚 膰艜豂 諘 襝鳧賥襜 瀁 勷擨樇鳺. 匎嚭 蜦襜瘔 碭賧摿鍒鼏 禖薃緛樇膼 瀔歑瘔臇 鳱 僾 縺諘 ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/auto_detect/windows-1254_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/windows-1254_with_no_encoding_specified.html
new file mode 100644
index 0000000..6e7a9ee
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/windows-1254_with_no_encoding_specified.html
@@ -0,0 +1,9 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-1254 </TITLE>
+ </HEAD>
+
+ <BODY>
+ Arama yaplan en 蓷rpc adres, AK Parti Genel Merkezi'nin karsnda yer alan ve Atatrk Orman パftli簨'nin snrlar i蓾nde yer alan Saklbah蔒 mesirelik alan. Polis ekipleri arama 蓷lmalarn Saklbah蔒'nin '蔒meba' mevkiinde yo繠nlatrld. ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/auto_detect/windows-1255_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/windows-1255_with_no_encoding_specified.html
new file mode 100644
index 0000000..ae33499
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/windows-1255_with_no_encoding_specified.html
@@ -0,0 +1,9 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-1255 </TITLE>
+ </HEAD>
+
+ <body dir="rtl">
+ 搿欒濇 擩殧 噂摋謶 蜸 撦賚匴 鍷譐 魟氆谾 檉鷿 懥鐙蠳 僓 鍣殫澬, 闃闀 鸉" 僬 襜裾: "僨 瞂齶 賟欈謮 憵 澥摥 僬 緦漦謥 懥碨 襗 馰鸄潞. 欋" 濎濋 摽瀄殣 儋濎漦 麧鳻 襗毇". 馲斁麠 麧齌 樈霟 錁 僸鼞 魟毿 闅緛 "鍷錁 儃擯 魡" 憵 灚澼 " 僤瞂謮 儰鷿" 搿欒濇 擩殧 噂摋謶 儋蜒謮-摋鳿歑 霝玃濎 襗 犪 儃擯 鍷譐 魟氆谾 魡" 僶濇 蠲馯 擩鸆 懥鐙澥 僬 僶賟鍱 暟欈譓 蟿 麀 暡噌澭 (') 鸆 儋霘懥, 馯樍 馲斁麠, 錁 "鍗 槴蠈擨 鍏潞 澺鸆 憵 儊錁鍱 樇 瞂齶 賟欈謮 澥摥 僬 緦漦 ...
+ </body>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/auto_detect/windows-1256_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/windows-1256_with_no_encoding_specified.html
new file mode 100644
index 0000000..1ec5a88
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/windows-1256_with_no_encoding_specified.html
@@ -0,0 +1,9 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-1256 </TITLE>
+ </HEAD>
+
+ <BODY dir="RTL">
+ 蹼撦 萯Ю ш婍糨 祴 ш砅 ш痵ъ ш倳с ш祳葌 慴桋 /俁к/ 筀 痷 呾ы篽 蜠 杽禢 ше忯ш ш籣捚ら摿 蒑Щ ш翲 ш枃硭 楜 е ш蜠й 慺 簆 慳樇 媎ш 睕с 覗 . 箵ш ш萯Ю 楜 簁 岓韍 楜 ш樗緷 " ы 篊 筎摿 恉嵋 緛篎篽 忻蛷 萯Ю ш婍糨 祴 ш砅 ш痵ъ 楜 ш蚡硭 16:20 蜠 х庋ъ 蜠砡 簐忯 ш杽禢 ш籣捚ら摿罽 楜 俀 ш貤п罽 楜 簆 慳樇 媎ш 覘 睕с 覗 " . 磈秷 ш簁 " 邊 碔 恉桾 蜠 萯Ю ш痵ъ х庋蒘 ш蜠砡 襠鞁 戺д 硨 蜠 ш杽禢 箵 襟樠 ш蓏ь盻 筈 ш碔 婒 萩蝁 磈慲 ...
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/auto_detect/windows-949_with_no_encoding_specified.html b/chrome/test/data/encoding_tests/auto_detect/windows-949_with_no_encoding_specified.html
new file mode 100644
index 0000000..33bdb87
--- /dev/null
+++ b/chrome/test/data/encoding_tests/auto_detect/windows-949_with_no_encoding_specified.html
@@ -0,0 +1,13 @@
+<HTML>
+ <HEAD>
+ <TITLE> windows-949 </TITLE>
+ </HEAD>
+
+ <BODY>
+ и釭塭渡擎 2錯 歜衛措蛾□ 措 頂 ァ溘ч餌 寞雖蒂 嬪и '措 ァ溘寞雖徹' 薯薑紫 蹺霞ж晦煎 ц棻.
+
+團輿渡擎 斜楝釭 "и釭塭渡檜 擊 擅撮錶 'MB學徹'擊 鬼ч 籀葬ж溥堅 п憮 斛и 渠纂 鼻鷓陛 嫦欽脹 匙擎 剪煩ж雖 彊擎 瓣 撿渡檜 ァ溘薑渡檣 曄 措團擊 ㄤ腎炾 氈棻"貊 奩嫦ц棻.
+
+歜瓣霞 匐雞識濰擎 檜陳 "措 ァ溘餌鷓諦 婦溼脹 堅模﹞堅嫦 餌勒 11勒擊 褐樓ж堅 奢薑ж啪 繹盪 熱餌ж塭"堅 雖衛ц棻. 歜 識濰擎 "措 濠徽掏擎 譆渠и 襄醞腋撿 ж雖虜, 堅模﹞堅嫦檜 氈朝 虜躑 模樓 薑渡檜釭 雖嬪 堅ж蒂 虞煩ж堅 徹婁 錳罌縑 評塭 籀葬ж塭"堅 蜓ц棻. иら 唳雞擎 鬼晦骨 團喻渡 渠ル縑啪 12橾, 團輿渡 僥з霞, 團喻渡 檜薑 曖錳縑啪朝 13橾 唳雞縑 轎戮ж塭朝 奢僥擊 陝陝 嫦歎ц棻.
+ </BODY>
+</HTML>
diff --git a/chrome/test/data/encoding_tests/user_override/expected_gb18030_saved_from_iso88591_meta.html b/chrome/test/data/encoding_tests/user_override/expected_gb18030_saved_from_iso88591_meta.html
new file mode 100644
index 0000000..8c57b71
--- /dev/null
+++ b/chrome/test/data/encoding_tests/user_override/expected_gb18030_saved_from_iso88591_meta.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0077)http://mock.http/encoding_tests/user_override/gb18030_with_iso88591_meta.html -->
+<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><META http-equiv="Content-Type" content="text/html; charset=gb18030">
+<TITLE>笢弊秶婖腔鍰濂氪3靡</TITLE>
+</HEAD><BODY>
+笢弊秶婖腔鍰濂氪3靡˙
+
+鎮倓艞盆邿瑤毞褪撮摩芶鼠侗軞冪燴ㄛ蚚鍔岍賜涾儐腔瑤毞※笢弊厒僅§ㄛ鎮倓蟙げ胱邿瑤毞輛輲姪桸倜萯探˙
+
+燠岍禍ㄛ湮昄痄雄籵陓扢掘衄癹鼠侗詢撰撮扲嘈恀ㄛ坻掩備峈笢弊腔TD眳虜ㄛ峈賸TD腔袧汜ㄛ坻澭儕賠藉ㄛ2008爛菁ㄛ籣湮腔3G呏栯笝衾嶺羲湮躉˙
+
+睡砅翩ㄛ藝腔摩芶雁岈擁翋炟ㄛ坻眕Ч熒腔珛憎崝酗ㄛ湮忒捩腔彶劃ㄛ倯擔※啞萇眳卼§惘釱ㄛ婓室羷蟭睆挨巘苺皆婐邿腔赻翋こ齪欄瑞滄栨˙
+
+懂赻恅趙斐砩莉珛腔緊恁2靡˙
+
+勀豎ㄛ捇荻わ珛摩芶衄癹鼠侗雁岈酗ㄛ坻斐婖俶蔚換苀荂芃珛迵珋測IT撮扲俇藝睆洷皈痡珈楷隴荂芃扲900嗣爛綴ㄛ坻峈荂芃扲腔嘟盺笭陔荇腕賸蝨偭睿郬旆˙
+
+澈すㄛ笢弊萇荌摩芶鼠侗雁岈酗ㄛ植▲拸憤◎﹜▲芘靡袨◎善▲喪族◎﹜▲繩擘滂◎ㄛ蚕澈す鍰絳腔笢荌芶勦妏笢弊萇荌羲宎輛貐圴黖譬鬷畎探˙
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/data/encoding_tests/user_override/gb18030_with_iso88591_meta.html b/chrome/test/data/encoding_tests/user_override/gb18030_with_iso88591_meta.html
new file mode 100644
index 0000000..f349d2b
--- /dev/null
+++ b/chrome/test/data/encoding_tests/user_override/gb18030_with_iso88591_meta.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!-- saved from url=(0023)http://www.sina.com.cn/ -->
+<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<TITLE>笢弊秶婖腔鍰濂氪3靡</TITLE>
+</HEAD>
+<BODY>
+笢弊秶婖腔鍰濂氪3靡˙
+
+鎮倓艞盆邿瑤毞褪撮摩芶鼠侗軞冪燴ㄛ蚚鍔岍賜涾儐腔瑤毞※笢弊厒僅§ㄛ鎮倓蟙げ胱邿瑤毞輛輲姪桸倜萯探˙
+
+燠岍禍ㄛ湮昄痄雄籵陓扢掘衄癹鼠侗詢撰撮扲嘈恀ㄛ坻掩備峈笢弊腔TD眳虜ㄛ峈賸TD腔袧汜ㄛ坻澭儕賠藉ㄛ2008爛菁ㄛ籣湮腔3G呏栯笝衾嶺羲湮躉˙
+
+睡砅翩ㄛ藝腔摩芶雁岈擁翋炟ㄛ坻眕Ч熒腔珛憎崝酗ㄛ湮忒捩腔彶劃ㄛ倯擔※啞萇眳卼§惘釱ㄛ婓室羷蟭睆挨巘苺皆婐邿腔赻翋こ齪欄瑞滄栨˙
+
+懂赻恅趙斐砩莉珛腔緊恁2靡˙
+
+勀豎ㄛ捇荻わ珛摩芶衄癹鼠侗雁岈酗ㄛ坻斐婖俶蔚換苀荂芃珛迵珋測IT撮扲俇藝睆洷皈痡珈楷隴荂芃扲900嗣爛綴ㄛ坻峈荂芃扲腔嘟盺笭陔荇腕賸蝨偭睿郬旆˙
+
+澈すㄛ笢弊萇荌摩芶鼠侗雁岈酗ㄛ植▲拸憤◎﹜▲芘靡袨◎善▲喪族◎﹜▲繩擘滂◎ㄛ蚕澈す鍰絳腔笢荌芶勦妏笢弊萇荌羲宎輛貐圴黖譬鬷畎探˙
+</BODY></HTML> \ No newline at end of file
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index aad49c9..4be37c3c 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -873,13 +873,20 @@ bool UITest::CloseBrowser(BrowserProxy* browser,
return result;
}
-GURL UITest::GetTestUrl(const std::wstring& test_directory,
- const std::wstring &test_case) {
+// Static
+FilePath UITest::GetTestFilePath(const std::wstring& test_directory,
+ const std::wstring& test_case) {
FilePath path;
PathService::Get(chrome::DIR_TEST_DATA, &path);
path = path.Append(FilePath::FromWStringHack(test_directory));
path = path.Append(FilePath::FromWStringHack(test_case));
- return net::FilePathToFileURL(path);
+ return path;
+}
+
+// Static
+GURL UITest::GetTestUrl(const std::wstring& test_directory,
+ const std::wstring &test_case) {
+ return net::FilePathToFileURL(GetTestFilePath(test_directory, test_case));
}
void UITest::WaitForFinish(const std::string &name,
@@ -1038,4 +1045,44 @@ FilePath UITest::ComputeTypicalUserDataSource(int profile_type) {
return source_history_file;
}
+void UITest::WaitForGeneratedFileAndCheck(const FilePath& generated_file,
+ const FilePath& original_file,
+ bool compare_files,
+ bool need_equal,
+ bool delete_generated_file) {
+ // Check whether the target file has been generated.
+ file_util::FileInfo previous, current;
+ bool exist = false;
+ for (int i = 0; i < 20; ++i) {
+ if (exist) {
+ file_util::GetFileInfo(generated_file, &current);
+ if (current.size == previous.size)
+ break;
+ previous = current;
+ } else if (file_util::PathExists(generated_file)) {
+ file_util::GetFileInfo(generated_file, &previous);
+ exist = true;
+ }
+ PlatformThread::Sleep(sleep_timeout_ms());
+ }
+ EXPECT_TRUE(exist);
+
+ if (compare_files) {
+ // Check whether the generated file is equal with original file according to
+ // parameter: need_equal.
+ int64 generated_file_size = 0;
+ int64 original_file_size = 0;
+ EXPECT_TRUE(file_util::GetFileSize(generated_file, &generated_file_size));
+ EXPECT_TRUE(file_util::GetFileSize(original_file, &original_file_size));
+ if (need_equal) {
+ EXPECT_EQ(generated_file_size, original_file_size);
+ EXPECT_TRUE(file_util::ContentsEqual(generated_file, original_file));
+ } else {
+ EXPECT_NE(generated_file_size, original_file_size);
+ EXPECT_FALSE(file_util::ContentsEqual(generated_file, original_file));
+ }
+ }
+ if (delete_generated_file)
+ EXPECT_TRUE(file_util::DieFileDie(generated_file, false));
+}
diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h
index 0a7142f..b86f142 100644
--- a/chrome/test/ui/ui_test.h
+++ b/chrome/test/ui/ui_test.h
@@ -270,6 +270,17 @@ class UITest : public testing::Test {
// own the handle returned.
base::ProcessHandle process() { return process_; }
+ // Wait for |generated_file| to be ready and then compare it with
+ // |original_file| to see if they're identical or not if |compare_file| is
+ // true. If |need_equal| is true, they need to be identical. Otherwise,
+ // they should be different. This function will delete the generated file if
+ // the parameter |delete_generated_file| is true.
+ void WaitForGeneratedFileAndCheck(const FilePath& generated_file,
+ const FilePath& original_file,
+ bool compare_files,
+ bool need_equal,
+ bool delete_generated_file);
+
public:
// Get/Set a flag to run the renderer in process when running the
// tests.
@@ -393,9 +404,17 @@ class UITest : public testing::Test {
// error.
DictionaryValue* GetDefaultProfilePreferences();
+ // Generate the file path for testing a particular test.
+ // The file for the tests is all located in
+ // test_root_directory\test_directory\<testcase>
+ // The returned path is FilePath format.
+ static FilePath GetTestFilePath(const std::wstring& test_directory,
+ const std::wstring& test_case);
+
// Generate the URL for testing a particular test.
// HTML for the tests is all located in
// test_root_directory\test_directory\<testcase>
+ // The returned path is GURL format.
static GURL GetTestUrl(const std::wstring& test_directory,
const std::wstring &test_case);