OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <string> | 4 #include <string> |
5 | 5 |
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/common/pref_names.h" | 8 #include "chrome/common/pref_names.h" |
9 #include "chrome/test/automation/automation_proxy.h" | 9 #include "chrome/test/automation/automation_proxy.h" |
10 #include "chrome/test/automation/browser_proxy.h" | 10 #include "chrome/test/automation/browser_proxy.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // Full path of saved file. full_file_name = save_dir_ + file_name[i]; | 242 // Full path of saved file. full_file_name = save_dir_ + file_name[i]; |
243 FilePath full_saved_file_name; | 243 FilePath full_saved_file_name; |
244 | 244 |
245 FilePath test_dir_path = FilePath(kTestDir).AppendASCII(kAutoDetectDir); | 245 FilePath test_dir_path = FilePath(kTestDir).AppendASCII(kAutoDetectDir); |
246 | 246 |
247 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 247 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
248 ASSERT_TRUE(browser.get()); | 248 ASSERT_TRUE(browser.get()); |
249 // Set the default charset to one of encodings not supported by the current | 249 // Set the default charset to one of encodings not supported by the current |
250 // auto-detector (Please refer to the above comments) to make sure we | 250 // auto-detector (Please refer to the above comments) to make sure we |
251 // incorrectly decode the page. Now we use ISO-8859-4. | 251 // incorrectly decode the page. Now we use ISO-8859-4. |
252 ASSERT_TRUE(browser->SetStringPreference(prefs::kDefaultCharset, | 252 ASSERT_TRUE(browser->SetStringPreference(prefs::kGlobalDefaultCharset, |
253 "ISO-8859-4")); | 253 "ISO-8859-4")); |
254 scoped_refptr<TabProxy> tab(GetActiveTab()); | 254 scoped_refptr<TabProxy> tab(GetActiveTab()); |
255 ASSERT_TRUE(tab.get()); | 255 ASSERT_TRUE(tab.get()); |
256 | 256 |
257 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestDatas);i++) { | 257 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestDatas);i++) { |
258 FilePath test_file_path(test_dir_path); | 258 FilePath test_file_path(test_dir_path); |
259 test_file_path = test_file_path.AppendASCII(kTestDatas[i].test_file_name); | 259 test_file_path = test_file_path.AppendASCII(kTestDatas[i].test_file_name); |
260 GURL url = | 260 GURL url = |
261 URLRequestMockHTTPJob::GetMockUrl(test_file_path); | 261 URLRequestMockHTTPJob::GetMockUrl(test_file_path); |
262 ASSERT_TRUE(tab->NavigateToURL(url)); | 262 ASSERT_TRUE(tab->NavigateToURL(url)); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 expected_result_file_name = expected_result_file_name.AppendASCII( | 295 expected_result_file_name = expected_result_file_name.AppendASCII( |
296 kExpectedResultDir); | 296 kExpectedResultDir); |
297 expected_result_file_name = expected_result_file_name.AppendASCII( | 297 expected_result_file_name = expected_result_file_name.AppendASCII( |
298 kTestDatas[i].expected_result); | 298 kTestDatas[i].expected_result); |
299 EXPECT_TRUE(tab->SavePage(full_saved_file_name, temp_sub_resource_dir_, | 299 EXPECT_TRUE(tab->SavePage(full_saved_file_name, temp_sub_resource_dir_, |
300 SavePackage::SAVE_AS_COMPLETE_HTML)); | 300 SavePackage::SAVE_AS_COMPLETE_HTML)); |
301 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); | 301 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); |
302 CheckFile(full_saved_file_name, expected_result_file_name, true); | 302 CheckFile(full_saved_file_name, expected_result_file_name, true); |
303 } | 303 } |
304 } | 304 } |
OLD | NEW |