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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 // Returns full paths of destination file and directory. | 93 // Returns full paths of destination file and directory. |
94 void GetDestinationPaths(const std::string& prefix, | 94 void GetDestinationPaths(const std::string& prefix, |
95 FilePath* full_file_name, | 95 FilePath* full_file_name, |
96 FilePath* dir) { | 96 FilePath* dir) { |
97 *full_file_name = save_dir_.path().AppendASCII(prefix + ".htm"); | 97 *full_file_name = save_dir_.path().AppendASCII(prefix + ".htm"); |
98 *dir = save_dir_.path().AppendASCII(prefix + "_files"); | 98 *dir = save_dir_.path().AppendASCII(prefix + "_files"); |
99 } | 99 } |
100 | 100 |
101 WebContents* GetCurrentTab() const { | 101 WebContents* GetCurrentTab() const { |
102 WebContents* current_tab = browser()->GetSelectedWebContents(); | 102 WebContents* current_tab = browser()->GetActiveWebContents(); |
103 EXPECT_TRUE(current_tab); | 103 EXPECT_TRUE(current_tab); |
104 return current_tab; | 104 return current_tab; |
105 } | 105 } |
106 | 106 |
107 | 107 |
108 GURL WaitForSavePackageToFinish() const { | 108 GURL WaitForSavePackageToFinish() const { |
109 ui_test_utils::WindowedNotificationObserver observer( | 109 ui_test_utils::WindowedNotificationObserver observer( |
110 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, | 110 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, |
111 content::NotificationService::AllSources()); | 111 content::NotificationService::AllSources()); |
112 observer.Wait(); | 112 observer.Wait(); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 content::NotificationService::AllSources()); | 407 content::NotificationService::AllSources()); |
408 browser()->SavePage(); | 408 browser()->SavePage(); |
409 observer.Wait(); | 409 observer.Wait(); |
410 CheckDownloadHistory(url, full_file_name, -1); | 410 CheckDownloadHistory(url, full_file_name, -1); |
411 | 411 |
412 EXPECT_TRUE(file_util::PathExists(full_file_name)); | 412 EXPECT_TRUE(file_util::PathExists(full_file_name)); |
413 int64 actual_file_size = -1; | 413 int64 actual_file_size = -1; |
414 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); | 414 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); |
415 EXPECT_LE(kFileSizeMin, actual_file_size); | 415 EXPECT_LE(kFileSizeMin, actual_file_size); |
416 } | 416 } |
OLD | NEW |