OLD | NEW |
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 FilePath save_dir_; | 69 FilePath save_dir_; |
70 FilePath temp_sub_resource_dir_; | 70 FilePath temp_sub_resource_dir_; |
71 }; | 71 }; |
72 | 72 |
73 // TODO(jnd): 1. Some encodings are missing here. It'll be added later. See | 73 // TODO(jnd): 1. Some encodings are missing here. It'll be added later. See |
74 // http://crbug.com/13306. | 74 // http://crbug.com/13306. |
75 // 2. Add more files with multiple encoding name variants for each canonical | 75 // 2. Add more files with multiple encoding name variants for each canonical |
76 // encoding name). Webkit layout tests cover some, but testing in the UI test is | 76 // encoding name). Webkit layout tests cover some, but testing in the UI test is |
77 // also necessary. | 77 // also necessary. |
78 // SLOW_ is added for XP debug bots. These tests should really be unittests... | 78 // SLOW_ is added for XP debug bots. These tests should really be unittests... |
79 // | 79 IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, SLOW_TestEncodingAliasMapping) { |
80 // The tests times out under ASan, see http://crbug.com/127748. | |
81 #if defined(ADDRESS_SANITIZER) | |
82 #define MAYBE_TestEncodingAliasMapping DISABLED_TestEncodingAliasMapping | |
83 #else | |
84 #define MAYBE_TestEncodingAliasMapping SLOW_TestEncodingAliasMapping | |
85 #endif | |
86 IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, MAYBE_TestEncodingAliasMapping) { | |
87 struct EncodingTestData { | 80 struct EncodingTestData { |
88 const char* file_name; | 81 const char* file_name; |
89 const char* encoding_name; | 82 const char* encoding_name; |
90 }; | 83 }; |
91 | 84 |
92 const EncodingTestData kEncodingTestDatas[] = { | 85 const EncodingTestData kEncodingTestDatas[] = { |
93 { "Big5.html", "Big5" }, | 86 { "Big5.html", "Big5" }, |
94 { "EUC-JP.html", "EUC-JP" }, | 87 { "EUC-JP.html", "EUC-JP" }, |
95 { "gb18030.html", "gb18030" }, | 88 { "gb18030.html", "gb18030" }, |
96 { "iso-8859-1.html", "ISO-8859-1" }, | 89 { "iso-8859-1.html", "ISO-8859-1" }, |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 EXPECT_EQ(kTestDatas[i].expected_encoding, web_contents->GetEncoding()); | 282 EXPECT_EQ(kTestDatas[i].expected_encoding, web_contents->GetEncoding()); |
290 | 283 |
291 // Dump the page, the content of dump page should be equal with our expect | 284 // Dump the page, the content of dump page should be equal with our expect |
292 // result file. | 285 // result file. |
293 FilePath expected_result_file_name = | 286 FilePath expected_result_file_name = |
294 FilePath().AppendASCII(kAutoDetectDir).AppendASCII(kExpectedResultDir). | 287 FilePath().AppendASCII(kAutoDetectDir).AppendASCII(kExpectedResultDir). |
295 AppendASCII(kTestDatas[i].expected_result); | 288 AppendASCII(kTestDatas[i].expected_result); |
296 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); | 289 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); |
297 } | 290 } |
298 } | 291 } |
OLD | NEW |