| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 EXPECT_TRUE(file_util::ContentsEqual( | 277 EXPECT_TRUE(file_util::ContentsEqual( |
| 278 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.png"), | 278 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.png"), |
| 279 dir.AppendASCII("1.png"))); | 279 dir.AppendASCII("1.png"))); |
| 280 EXPECT_TRUE(file_util::ContentsEqual( | 280 EXPECT_TRUE(file_util::ContentsEqual( |
| 281 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.css"), | 281 test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.css"), |
| 282 dir.AppendASCII("1.css"))); | 282 dir.AppendASCII("1.css"))); |
| 283 } | 283 } |
| 284 | 284 |
| 285 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, NoSave) { | 285 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, NoSave) { |
| 286 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); | 286 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); |
| 287 ASSERT_TRUE(browser()->command_updater()->SupportsCommand(IDC_SAVE_PAGE)); | 287 EXPECT_FALSE(chrome::CanSavePage(browser())); |
| 288 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_SAVE_PAGE)); | |
| 289 } | 288 } |
| 290 | 289 |
| 291 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, FileNameFromPageTitle) { | 290 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, FileNameFromPageTitle) { |
| 292 GURL url = NavigateToMockURL("b"); | 291 GURL url = NavigateToMockURL("b"); |
| 293 | 292 |
| 294 FilePath full_file_name = save_dir_.path().AppendASCII( | 293 FilePath full_file_name = save_dir_.path().AppendASCII( |
| 295 std::string("Test page for saving page feature") + kAppendedExtension); | 294 std::string("Test page for saving page feature") + kAppendedExtension); |
| 296 FilePath dir = save_dir_.path().AppendASCII( | 295 FilePath dir = save_dir_.path().AppendASCII( |
| 297 "Test page for saving page feature_files"); | 296 "Test page for saving page feature_files"); |
| 298 ASSERT_TRUE(GetCurrentTab()->SavePage( | 297 ASSERT_TRUE(GetCurrentTab()->SavePage( |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 content::NotificationService::AllSources()); | 407 content::NotificationService::AllSources()); |
| 409 chrome::SavePage(browser()); | 408 chrome::SavePage(browser()); |
| 410 observer.Wait(); | 409 observer.Wait(); |
| 411 CheckDownloadHistory(url, full_file_name, -1); | 410 CheckDownloadHistory(url, full_file_name, -1); |
| 412 | 411 |
| 413 EXPECT_TRUE(file_util::PathExists(full_file_name)); | 412 EXPECT_TRUE(file_util::PathExists(full_file_name)); |
| 414 int64 actual_file_size = -1; | 413 int64 actual_file_size = -1; |
| 415 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); | 414 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); |
| 416 EXPECT_LE(kFileSizeMin, actual_file_size); | 415 EXPECT_LE(kFileSizeMin, actual_file_size); |
| 417 } | 416 } |
| OLD | NEW |