Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: chrome/browser/browser_encoding_uitest.cc

Issue 217008: Update the TabContents::SavePage parameter to take FilePath instead of wstrin... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: ToT Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // Re-get the encoding of page. It should be gb18030. 143 // Re-get the encoding of page. It should be gb18030.
144 EXPECT_TRUE(tab_proxy->GetPageCurrentEncoding(&encoding)); 144 EXPECT_TRUE(tab_proxy->GetPageCurrentEncoding(&encoding));
145 EXPECT_EQ(encoding, "gb18030"); 145 EXPECT_EQ(encoding, "gb18030");
146 146
147 // Dump the page, the content of dump page should be identical to the 147 // Dump the page, the content of dump page should be identical to the
148 // expected result file. 148 // expected result file.
149 FilePath full_file_name = save_dir_.AppendASCII(kTestFileName); 149 FilePath full_file_name = save_dir_.AppendASCII(kTestFileName);
150 // We save the page as way of complete HTML file, which requires a directory 150 // We save the page as way of complete HTML file, which requires a directory
151 // name to save sub resources in it. Although this test file does not have 151 // name to save sub resources in it. Although this test file does not have
152 // sub resources, but the directory name is still required. 152 // sub resources, but the directory name is still required.
153 EXPECT_TRUE(tab_proxy->SavePage(full_file_name.ToWStringHack(), 153 EXPECT_TRUE(tab_proxy->SavePage(full_file_name, temp_sub_resource_dir_,
154 temp_sub_resource_dir_.ToWStringHack(),
155 SavePackage::SAVE_AS_COMPLETE_HTML)); 154 SavePackage::SAVE_AS_COMPLETE_HTML));
156 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 155 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
157 ASSERT_TRUE(browser.get()); 156 ASSERT_TRUE(browser.get());
158 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); 157 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get()));
159 FilePath expected_file_name = FilePath().AppendASCII(kOverrideTestDir); 158 FilePath expected_file_name = FilePath().AppendASCII(kOverrideTestDir);
160 expected_file_name = expected_file_name.AppendASCII(kExpectedFileName); 159 expected_file_name = expected_file_name.AppendASCII(kExpectedFileName);
161 CheckFile(full_file_name, expected_file_name, true); 160 CheckFile(full_file_name, expected_file_name, true);
162 } 161 }
163 #endif // defined(OS_WIN) 162 #endif // defined(OS_WIN)
164 163
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 282
284 // Dump the page, the content of dump page should be equal with our expect 283 // Dump the page, the content of dump page should be equal with our expect
285 // result file. 284 // result file.
286 full_saved_file_name = save_dir_.AppendASCII(kTestDatas[i].test_file_name); 285 full_saved_file_name = save_dir_.AppendASCII(kTestDatas[i].test_file_name);
287 // Full path of expect result file. 286 // Full path of expect result file.
288 FilePath expected_result_file_name = FilePath().AppendASCII(kAutoDetectDir); 287 FilePath expected_result_file_name = FilePath().AppendASCII(kAutoDetectDir);
289 expected_result_file_name = expected_result_file_name.AppendASCII( 288 expected_result_file_name = expected_result_file_name.AppendASCII(
290 kExpectedResultDir); 289 kExpectedResultDir);
291 expected_result_file_name = expected_result_file_name.AppendASCII( 290 expected_result_file_name = expected_result_file_name.AppendASCII(
292 kTestDatas[i].expected_result); 291 kTestDatas[i].expected_result);
293 EXPECT_TRUE(tab->SavePage(full_saved_file_name.ToWStringHack(), 292 EXPECT_TRUE(tab->SavePage(full_saved_file_name, temp_sub_resource_dir_,
294 temp_sub_resource_dir_.ToWStringHack(),
295 SavePackage::SAVE_AS_COMPLETE_HTML)); 293 SavePackage::SAVE_AS_COMPLETE_HTML));
296 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get())); 294 EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get()));
297 CheckFile(full_saved_file_name, expected_result_file_name, true); 295 CheckFile(full_saved_file_name, expected_result_file_name, true);
298 } 296 }
299 } 297 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | chrome/browser/download/save_page_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698