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/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/character_encoding.h" | 9 #include "chrome/browser/character_encoding.h" |
10 #include "chrome/browser/net/url_request_mock_util.h" | 10 #include "chrome/browser/net/url_request_mock_util.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 content::BrowserContext::GetDownloadManager(browser()->profile()), | 126 content::BrowserContext::GetDownloadManager(browser()->profile()), |
127 loop_runner->QuitClosure()); | 127 loop_runner->QuitClosure()); |
128 browser()->tab_strip_model()->GetActiveWebContents()->SavePage( | 128 browser()->tab_strip_model()->GetActiveWebContents()->SavePage( |
129 full_file_name, temp_sub_resource_dir_, | 129 full_file_name, temp_sub_resource_dir_, |
130 content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML); | 130 content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML); |
131 loop_runner->Run(); | 131 loop_runner->Run(); |
132 | 132 |
133 base::FilePath expected_file_name = ui_test_utils::GetTestFilePath( | 133 base::FilePath expected_file_name = ui_test_utils::GetTestFilePath( |
134 base::FilePath(kTestDir), expected); | 134 base::FilePath(kTestDir), expected); |
135 | 135 |
136 EXPECT_TRUE(file_util::ContentsEqual(full_file_name, expected_file_name)); | 136 EXPECT_TRUE(base::ContentsEqual(full_file_name, expected_file_name)); |
137 } | 137 } |
138 | 138 |
139 virtual void SetUpOnMainThread() OVERRIDE { | 139 virtual void SetUpOnMainThread() OVERRIDE { |
140 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 140 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
141 save_dir_ = temp_dir_.path(); | 141 save_dir_ = temp_dir_.path(); |
142 temp_sub_resource_dir_ = save_dir_.AppendASCII("sub_resource_files"); | 142 temp_sub_resource_dir_ = save_dir_.AppendASCII("sub_resource_files"); |
143 | 143 |
144 BrowserThread::PostTask( | 144 BrowserThread::PostTask( |
145 BrowserThread::IO, FROM_HERE, | 145 BrowserThread::IO, FROM_HERE, |
146 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); | 146 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 323 |
324 // Dump the page, the content of dump page should be equal with our expect | 324 // Dump the page, the content of dump page should be equal with our expect |
325 // result file. | 325 // result file. |
326 base::FilePath expected_result_file_name = | 326 base::FilePath expected_result_file_name = |
327 base::FilePath().AppendASCII(kAutoDetectDir). | 327 base::FilePath().AppendASCII(kAutoDetectDir). |
328 AppendASCII(kExpectedResultDir). | 328 AppendASCII(kExpectedResultDir). |
329 AppendASCII(kTestDatas[i].expected_result); | 329 AppendASCII(kTestDatas[i].expected_result); |
330 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); | 330 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); |
331 } | 331 } |
332 } | 332 } |
OLD | NEW |