| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/browser/net/url_request_mock_http_job.h" | 8 #include "chrome/browser/net/url_request_mock_http_job.h" |
| 9 #include "chrome/browser/download/save_package.h" | 9 #include "chrome/browser/download/save_package.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // Dump the page, the content of dump page should be identical to the | 142 // Dump the page, the content of dump page should be identical to the |
| 143 // expected result file. | 143 // expected result file. |
| 144 FilePath full_file_name = save_dir_.AppendASCII(kTestFileName); | 144 FilePath full_file_name = save_dir_.AppendASCII(kTestFileName); |
| 145 // We save the page as way of complete HTML file, which requires a directory | 145 // We save the page as way of complete HTML file, which requires a directory |
| 146 // name to save sub resources in it. Although this test file does not have | 146 // name to save sub resources in it. Although this test file does not have |
| 147 // sub resources, but the directory name is still required. | 147 // sub resources, but the directory name is still required. |
| 148 EXPECT_TRUE(tab_proxy->SavePage(full_file_name, temp_sub_resource_dir_, | 148 EXPECT_TRUE(tab_proxy->SavePage(full_file_name, temp_sub_resource_dir_, |
| 149 SavePackage::SAVE_AS_COMPLETE_HTML)); | 149 SavePackage::SAVE_AS_COMPLETE_HTML)); |
| 150 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 150 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 151 ASSERT_TRUE(browser.get()); | 151 ASSERT_TRUE(browser.get()); |
| 152 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); | 152 EXPECT_TRUE(browser->WaitForDownloadShelfVisibilityChange(true)); |
| 153 FilePath expected_file_name = FilePath().AppendASCII(kOverrideTestDir); | 153 FilePath expected_file_name = FilePath().AppendASCII(kOverrideTestDir); |
| 154 expected_file_name = expected_file_name.AppendASCII(kExpectedFileName); | 154 expected_file_name = expected_file_name.AppendASCII(kExpectedFileName); |
| 155 CheckFile(full_file_name, expected_file_name, true); | 155 CheckFile(full_file_name, expected_file_name, true); |
| 156 } | 156 } |
| 157 | 157 |
| 158 // The following encodings are excluded from the auto-detection test because | 158 // The following encodings are excluded from the auto-detection test because |
| 159 // it's a known issue that the current encoding detector does not detect them: | 159 // it's a known issue that the current encoding detector does not detect them: |
| 160 // ISO-8859-4 | 160 // ISO-8859-4 |
| 161 // ISO-8859-13 | 161 // ISO-8859-13 |
| 162 // KOI8-U | 162 // KOI8-U |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // result file. | 279 // result file. |
| 280 full_saved_file_name = save_dir_.AppendASCII(kTestDatas[i].test_file_name); | 280 full_saved_file_name = save_dir_.AppendASCII(kTestDatas[i].test_file_name); |
| 281 // Full path of expect result file. | 281 // Full path of expect result file. |
| 282 FilePath expected_result_file_name = FilePath().AppendASCII(kAutoDetectDir); | 282 FilePath expected_result_file_name = FilePath().AppendASCII(kAutoDetectDir); |
| 283 expected_result_file_name = expected_result_file_name.AppendASCII( | 283 expected_result_file_name = expected_result_file_name.AppendASCII( |
| 284 kExpectedResultDir); | 284 kExpectedResultDir); |
| 285 expected_result_file_name = expected_result_file_name.AppendASCII( | 285 expected_result_file_name = expected_result_file_name.AppendASCII( |
| 286 kTestDatas[i].expected_result); | 286 kTestDatas[i].expected_result); |
| 287 EXPECT_TRUE(tab->SavePage(full_saved_file_name, temp_sub_resource_dir_, | 287 EXPECT_TRUE(tab->SavePage(full_saved_file_name, temp_sub_resource_dir_, |
| 288 SavePackage::SAVE_AS_COMPLETE_HTML)); | 288 SavePackage::SAVE_AS_COMPLETE_HTML)); |
| 289 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); | 289 EXPECT_TRUE(browser->WaitForDownloadShelfVisibilityChange(true)); |
| 290 CheckFile(full_saved_file_name, expected_result_file_name, true); | 290 CheckFile(full_saved_file_name, expected_result_file_name, true); |
| 291 } | 291 } |
| 292 } | 292 } |
| OLD | NEW |