Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: chrome/browser/download/save_page_browsertest.cc

Issue 12084075: SavePackageFilePickerChromeOS should only force MHTML when saving HTML, not when saving text/image/… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r185696 Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 loop_runner->Run(); 771 loop_runner->Run();
772 ASSERT_TRUE(VerifySavePackageExpectations(browser(), url)); 772 ASSERT_TRUE(VerifySavePackageExpectations(browser(), url));
773 persisted.WaitForPersisted(); 773 persisted.WaitForPersisted();
774 774
775 EXPECT_TRUE(file_util::PathExists(full_file_name)); 775 EXPECT_TRUE(file_util::PathExists(full_file_name));
776 int64 actual_file_size = -1; 776 int64 actual_file_size = -1;
777 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); 777 EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size));
778 EXPECT_LE(kFileSizeMin, actual_file_size); 778 EXPECT_LE(kFileSizeMin, actual_file_size);
779 } 779 }
780 780
781 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SavePageBrowserTest_NonMHTML) {
782 #if defined(OS_CHROMEOS)
783 SavePackageFilePickerChromeOS::SetShouldPromptUser(false);
784 #else
785 SavePackageFilePicker::SetShouldPromptUser(false);
786 #endif
787 GURL url("data:text/plain,foo");
788 ui_test_utils::NavigateToURL(browser(), url);
789 scoped_refptr<content::MessageLoopRunner> loop_runner(
790 new content::MessageLoopRunner);
791 SavePackageFinishedObserver observer(
792 content::BrowserContext::GetDownloadManager(browser()->profile()),
793 loop_runner->QuitClosure());
794 chrome::SavePage(browser());
795 loop_runner->Run();
796 base::FilePath download_dir = DownloadPrefs::FromDownloadManager(
797 GetDownloadManager())->DownloadPath();
798 base::FilePath filename = download_dir.AppendASCII("dataurl.txt");
799 EXPECT_TRUE(file_util::PathExists(filename));
800 std::string contents;
801 EXPECT_TRUE(file_util::ReadFileToString(filename, &contents));
802 EXPECT_EQ("foo", contents);
803 }
804
781 } // namespace 805 } // namespace
782 806
OLDNEW
« no previous file with comments | « chrome/browser/download/save_package_file_picker_chromeos.cc ('k') | content/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698