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/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // Query the history system. | 127 // Query the history system. |
128 ChromeDownloadManagerDelegate* delegate = | 128 ChromeDownloadManagerDelegate* delegate = |
129 static_cast<ChromeDownloadManagerDelegate*>( | 129 static_cast<ChromeDownloadManagerDelegate*>( |
130 GetDownloadManager()->GetDelegate()); | 130 GetDownloadManager()->GetDelegate()); |
131 delegate->download_history()->Load( | 131 delegate->download_history()->Load( |
132 base::Bind(&SavePageBrowserTest::OnQueryDownloadEntriesComplete, | 132 base::Bind(&SavePageBrowserTest::OnQueryDownloadEntriesComplete, |
133 base::Unretained(this))); | 133 base::Unretained(this))); |
134 | 134 |
135 // Run message loop until a quit message is sent from | 135 // Run message loop until a quit message is sent from |
136 // OnQueryDownloadEntriesComplete(). | 136 // OnQueryDownloadEntriesComplete(). |
137 ui_test_utils::RunMessageLoop(); | 137 content::RunMessageLoop(); |
138 } | 138 } |
139 | 139 |
140 void OnQueryDownloadEntriesComplete( | 140 void OnQueryDownloadEntriesComplete( |
141 std::vector<DownloadPersistentStoreInfo>* entries) { | 141 std::vector<DownloadPersistentStoreInfo>* entries) { |
142 history_entries_ = *entries; | 142 history_entries_ = *entries; |
143 | 143 |
144 // Indicate thet we have received the history and can continue. | 144 // Indicate thet we have received the history and can continue. |
145 MessageLoopForUI::current()->Quit(); | 145 MessageLoopForUI::current()->Quit(); |
146 } | 146 } |
147 | 147 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 content::NotificationService::AllSources()); | 408 content::NotificationService::AllSources()); |
409 chrome::SavePage(browser()); | 409 chrome::SavePage(browser()); |
410 observer.Wait(); | 410 observer.Wait(); |
411 CheckDownloadHistory(url, full_file_name, -1); | 411 CheckDownloadHistory(url, full_file_name, -1); |
412 | 412 |
413 EXPECT_TRUE(file_util::PathExists(full_file_name)); | 413 EXPECT_TRUE(file_util::PathExists(full_file_name)); |
414 int64 actual_file_size = -1; | 414 int64 actual_file_size = -1; |
415 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); | 415 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); |
416 EXPECT_LE(kFileSizeMin, actual_file_size); | 416 EXPECT_LE(kFileSizeMin, actual_file_size); |
417 } | 417 } |
OLD | NEW |