| 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 <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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 318 |
| 319 // Get the encoding used for the page, it must be the default charset we | 319 // Get the encoding used for the page, it must be the default charset we |
| 320 // just set. | 320 // just set. |
| 321 EXPECT_EQ("ISO-8859-4", web_contents->GetEncoding()); | 321 EXPECT_EQ("ISO-8859-4", web_contents->GetEncoding()); |
| 322 | 322 |
| 323 // Enable the encoding auto detection. | 323 // Enable the encoding auto detection. |
| 324 browser()->profile()->GetPrefs()->SetBoolean( | 324 browser()->profile()->GetPrefs()->SetBoolean( |
| 325 prefs::kWebKitUsesUniversalDetector, true); | 325 prefs::kWebKitUsesUniversalDetector, true); |
| 326 | 326 |
| 327 content::TestNavigationObserver observer(web_contents); | 327 content::TestNavigationObserver observer(web_contents); |
| 328 chrome::Reload(browser(), CURRENT_TAB); | 328 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); |
| 329 observer.Wait(); | 329 observer.Wait(); |
| 330 | 330 |
| 331 // Re-get the encoding of page. It should return the real encoding now. | 331 // Re-get the encoding of page. It should return the real encoding now. |
| 332 EXPECT_EQ(kTestDatas[i].expected_encoding, web_contents->GetEncoding()); | 332 EXPECT_EQ(kTestDatas[i].expected_encoding, web_contents->GetEncoding()); |
| 333 | 333 |
| 334 // Dump the page, the content of dump page should be equal with our expect | 334 // Dump the page, the content of dump page should be equal with our expect |
| 335 // result file. | 335 // result file. |
| 336 base::FilePath expected_result_file_name = | 336 base::FilePath expected_result_file_name = |
| 337 base::FilePath().AppendASCII(kAutoDetectDir). | 337 base::FilePath().AppendASCII(kAutoDetectDir). |
| 338 AppendASCII(kExpectedResultDir). | 338 AppendASCII(kExpectedResultDir). |
| 339 AppendASCII(kTestDatas[i].expected_result); | 339 AppendASCII(kTestDatas[i].expected_result); |
| 340 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); | 340 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); |
| 341 } | 341 } |
| 342 } | 342 } |
| OLD | NEW |