OLD | NEW |
1 // Copyright (c) 2006-2008 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 | 4 |
5 #include "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "chrome/app/chrome_dll_resource.h" | 8 #include "chrome/app/chrome_dll_resource.h" |
9 #include "chrome/browser/automation/url_request_mock_http_job.h" | 9 #include "chrome/browser/automation/url_request_mock_http_job.h" |
10 #include "chrome/browser/download/save_package.h" | 10 #include "chrome/browser/download/save_package.h" |
11 #include "chrome/common/chrome_paths.h" | 11 #include "chrome/common/chrome_paths.h" |
(...skipping 10 matching lines...) Expand all Loading... |
22 | 22 |
23 void CheckFile(const std::wstring& client_file, | 23 void CheckFile(const std::wstring& client_file, |
24 const std::wstring& server_file, | 24 const std::wstring& server_file, |
25 bool check_equal) { | 25 bool check_equal) { |
26 bool exist = false; | 26 bool exist = false; |
27 for (int i = 0; i < 20; ++i) { | 27 for (int i = 0; i < 20; ++i) { |
28 if (file_util::PathExists(client_file)) { | 28 if (file_util::PathExists(client_file)) { |
29 exist = true; | 29 exist = true; |
30 break; | 30 break; |
31 } | 31 } |
32 Sleep(sleep_timeout_ms()); | 32 PlatformThread::Sleep(sleep_timeout_ms()); |
33 } | 33 } |
34 EXPECT_TRUE(exist); | 34 EXPECT_TRUE(exist); |
35 | 35 |
36 if (check_equal) { | 36 if (check_equal) { |
37 std::wstring server_file_name; | 37 std::wstring server_file_name; |
38 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, | 38 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, |
39 &server_file_name)); | 39 &server_file_name)); |
40 server_file_name += L"\\" + kTestDir + L"\\" + server_file; | 40 server_file_name += L"\\" + kTestDir + L"\\" + server_file; |
41 ASSERT_TRUE(file_util::PathExists(server_file_name)); | 41 ASSERT_TRUE(file_util::PathExists(server_file_name)); |
42 | 42 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 159 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
160 automation()->SavePackageShouldPromptUser(false); | 160 automation()->SavePackageShouldPromptUser(false); |
161 EXPECT_TRUE(browser->RunCommandAsync(IDC_SAVE_PAGE)); | 161 EXPECT_TRUE(browser->RunCommandAsync(IDC_SAVE_PAGE)); |
162 EXPECT_TRUE(WaitForDownloadShelfVisible(tab.get())); | 162 EXPECT_TRUE(WaitForDownloadShelfVisible(tab.get())); |
163 automation()->SavePackageShouldPromptUser(true); | 163 automation()->SavePackageShouldPromptUser(true); |
164 | 164 |
165 CheckFile(full_file_name, file_name, false); | 165 CheckFile(full_file_name, file_name, false); |
166 EXPECT_TRUE(DieFileDie(full_file_name, false)); | 166 EXPECT_TRUE(DieFileDie(full_file_name, false)); |
167 EXPECT_TRUE(DieFileDie(dir, true)); | 167 EXPECT_TRUE(DieFileDie(dir, true)); |
168 } | 168 } |
OLD | NEW |