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/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/character_encoding.h" | 9 #include "chrome/browser/character_encoding.h" |
10 #include "chrome/browser/net/url_request_mock_util.h" | 10 #include "chrome/browser/net/url_request_mock_util.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 EXPECT_EQ(GetParam().encoding_name, | 171 EXPECT_EQ(GetParam().encoding_name, |
172 browser()->tab_strip_model()->GetActiveWebContents()-> | 172 browser()->tab_strip_model()->GetActiveWebContents()-> |
173 GetEncoding()); | 173 GetEncoding()); |
174 } | 174 } |
175 | 175 |
176 INSTANTIATE_TEST_CASE_P(EncodingAliases, | 176 INSTANTIATE_TEST_CASE_P(EncodingAliases, |
177 BrowserEncodingTest, | 177 BrowserEncodingTest, |
178 testing::ValuesIn(kEncodingTestDatas)); | 178 testing::ValuesIn(kEncodingTestDatas)); |
179 | 179 |
180 // Marked as flaky: see http://crbug.com/44668 | 180 // Marked as flaky: see http://crbug.com/44668 |
181 IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, DISABLED_TestOverrideEncoding) { | 181 IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, TestOverrideEncoding) { |
182 const char* const kTestFileName = "gb18030_with_iso88591_meta.html"; | 182 const char* const kTestFileName = "gb18030_with_iso88591_meta.html"; |
183 const char* const kExpectedFileName = | 183 const char* const kExpectedFileName = |
184 "expected_gb18030_saved_from_iso88591_meta.html"; | 184 "expected_gb18030_saved_from_iso88591_meta.html"; |
185 const char* const kOverrideTestDir = "user_override"; | 185 const char* const kOverrideTestDir = "user_override"; |
186 | 186 |
187 base::FilePath test_dir_path = | 187 base::FilePath test_dir_path = |
188 base::FilePath(kTestDir).AppendASCII(kOverrideTestDir); | 188 base::FilePath(kTestDir).AppendASCII(kOverrideTestDir); |
189 test_dir_path = test_dir_path.AppendASCII(kTestFileName); | 189 test_dir_path = test_dir_path.AppendASCII(kTestFileName); |
190 GURL url = net::URLRequestMockHTTPJob::GetMockUrl(test_dir_path); | 190 GURL url = net::URLRequestMockHTTPJob::GetMockUrl(test_dir_path); |
191 ui_test_utils::NavigateToURL(browser(), url); | 191 ui_test_utils::NavigateToURL(browser(), url); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // http://crbug.com/2927 for more details. | 223 // http://crbug.com/2927 for more details. |
224 // | 224 // |
225 // This test fails frequently on the win_rel trybot. See http://crbug.com/122053 | 225 // This test fails frequently on the win_rel trybot. See http://crbug.com/122053 |
226 // It also times out frequently on Mac dbg. See http://crbug.com/351325 | 226 // It also times out frequently on Mac dbg. See http://crbug.com/351325 |
227 #if defined(OS_WIN) || defined(OS_MACOSX) | 227 #if defined(OS_WIN) || defined(OS_MACOSX) |
228 #define MAYBE_TestEncodingAutoDetect DISABLED_TestEncodingAutoDetect | 228 #define MAYBE_TestEncodingAutoDetect DISABLED_TestEncodingAutoDetect |
229 #else | 229 #else |
230 #define MAYBE_TestEncodingAutoDetect TestEncodingAutoDetect | 230 #define MAYBE_TestEncodingAutoDetect TestEncodingAutoDetect |
231 #endif | 231 #endif |
232 // TODO(phajdan.jr): See if fix for http://crbug.com/122053 would help here. | 232 // TODO(phajdan.jr): See if fix for http://crbug.com/122053 would help here. |
233 IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, DISABLED_TestEncodingAutoDetect) { | 233 IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, TestEncodingAutoDetect) { |
234 struct EncodingAutoDetectTestData { | 234 struct EncodingAutoDetectTestData { |
235 const char* test_file_name; // File name of test data. | 235 const char* test_file_name; // File name of test data. |
236 const char* expected_result; // File name of expected results. | 236 const char* expected_result; // File name of expected results. |
237 const char* expected_encoding; // expected encoding. | 237 const char* expected_encoding; // expected encoding. |
238 }; | 238 }; |
239 const EncodingAutoDetectTestData kTestDatas[] = { | 239 const EncodingAutoDetectTestData kTestDatas[] = { |
240 { "Big5_with_no_encoding_specified.html", | 240 { "Big5_with_no_encoding_specified.html", |
241 "expected_Big5_saved_from_no_encoding_specified.html", | 241 "expected_Big5_saved_from_no_encoding_specified.html", |
242 "Big5" }, | 242 "Big5" }, |
243 { "gb18030_with_no_encoding_specified.html", | 243 { "gb18030_with_no_encoding_specified.html", |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 325 |
326 // Dump the page, the content of dump page should be equal with our expect | 326 // Dump the page, the content of dump page should be equal with our expect |
327 // result file. | 327 // result file. |
328 base::FilePath expected_result_file_name = | 328 base::FilePath expected_result_file_name = |
329 base::FilePath().AppendASCII(kAutoDetectDir). | 329 base::FilePath().AppendASCII(kAutoDetectDir). |
330 AppendASCII(kExpectedResultDir). | 330 AppendASCII(kExpectedResultDir). |
331 AppendASCII(kTestDatas[i].expected_result); | 331 AppendASCII(kTestDatas[i].expected_result); |
332 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); | 332 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); |
333 } | 333 } |
334 } | 334 } |
OLD | NEW |