| 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/files/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" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_commands.h" | 13 #include "chrome/browser/ui/browser_commands.h" |
| 14 #include "chrome/browser/ui/browser_tabstrip.h" | 14 #include "chrome/browser/ui/browser_tabstrip.h" |
| 15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
| 17 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 virtual void SetUpOnMainThread() OVERRIDE { | 58 virtual void SetUpOnMainThread() OVERRIDE { |
| 59 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 59 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 60 save_dir_ = temp_dir_.path(); | 60 save_dir_ = temp_dir_.path(); |
| 61 temp_sub_resource_dir_ = save_dir_.AppendASCII("sub_resource_files"); | 61 temp_sub_resource_dir_ = save_dir_.AppendASCII("sub_resource_files"); |
| 62 | 62 |
| 63 BrowserThread::PostTask( | 63 BrowserThread::PostTask( |
| 64 BrowserThread::IO, FROM_HERE, | 64 BrowserThread::IO, FROM_HERE, |
| 65 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); | 65 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 ScopedTempDir temp_dir_; | 68 base::ScopedTempDir temp_dir_; |
| 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... |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 EXPECT_EQ(kTestDatas[i].expected_encoding, web_contents->GetEncoding()); | 282 EXPECT_EQ(kTestDatas[i].expected_encoding, web_contents->GetEncoding()); |
| 283 | 283 |
| 284 // 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 |
| 285 // result file. | 285 // result file. |
| 286 FilePath expected_result_file_name = | 286 FilePath expected_result_file_name = |
| 287 FilePath().AppendASCII(kAutoDetectDir).AppendASCII(kExpectedResultDir). | 287 FilePath().AppendASCII(kAutoDetectDir).AppendASCII(kExpectedResultDir). |
| 288 AppendASCII(kTestDatas[i].expected_result); | 288 AppendASCII(kTestDatas[i].expected_result); |
| 289 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); | 289 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); |
| 290 } | 290 } |
| 291 } | 291 } |
| OLD | NEW |