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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 loop_runner->QuitClosure()); | 728 loop_runner->QuitClosure()); |
729 chrome::SavePage(browser()); | 729 chrome::SavePage(browser()); |
730 loop_runner->Run(); | 730 loop_runner->Run(); |
731 ASSERT_TRUE(VerifySavePackageExpectations(browser(), url)); | 731 ASSERT_TRUE(VerifySavePackageExpectations(browser(), url)); |
732 persisted.WaitForPersisted(); | 732 persisted.WaitForPersisted(); |
733 | 733 |
734 ASSERT_TRUE(base::PathExists(full_file_name)); | 734 ASSERT_TRUE(base::PathExists(full_file_name)); |
735 int64_t actual_file_size = -1; | 735 int64_t actual_file_size = -1; |
736 EXPECT_TRUE(base::GetFileSize(full_file_name, &actual_file_size)); | 736 EXPECT_TRUE(base::GetFileSize(full_file_name, &actual_file_size)); |
737 EXPECT_LE(kFileSizeMin, actual_file_size); | 737 EXPECT_LE(kFileSizeMin, actual_file_size); |
| 738 |
| 739 std::string contents; |
| 740 EXPECT_TRUE(base::ReadFileToString(full_file_name, &contents)); |
| 741 // Test for a CSS encoded character. This used to use HTML encoding. |
| 742 EXPECT_THAT(contents, HasSubstr("content: \"\\e003 \\e004 b\"")); |
738 } | 743 } |
739 | 744 |
740 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SavePageBrowserTest_NonMHTML) { | 745 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SavePageBrowserTest_NonMHTML) { |
741 SavePackageFilePicker::SetShouldPromptUser(false); | 746 SavePackageFilePicker::SetShouldPromptUser(false); |
742 GURL url("data:text/plain,foo"); | 747 GURL url("data:text/plain,foo"); |
743 ui_test_utils::NavigateToURL(browser(), url); | 748 ui_test_utils::NavigateToURL(browser(), url); |
744 scoped_refptr<content::MessageLoopRunner> loop_runner( | 749 scoped_refptr<content::MessageLoopRunner> loop_runner( |
745 new content::MessageLoopRunner); | 750 new content::MessageLoopRunner); |
746 SavePackageFinishedObserver observer( | 751 SavePackageFinishedObserver observer( |
747 content::BrowserContext::GetDownloadManager(browser()->profile()), | 752 content::BrowserContext::GetDownloadManager(browser()->profile()), |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 TestOriginalVsSavedPage(save_page_type, url, 1, expected_substrings); | 1246 TestOriginalVsSavedPage(save_page_type, url, 1, expected_substrings); |
1242 } | 1247 } |
1243 | 1248 |
1244 INSTANTIATE_TEST_CASE_P( | 1249 INSTANTIATE_TEST_CASE_P( |
1245 SaveType, | 1250 SaveType, |
1246 SavePageOriginalVsSavedComparisonTest, | 1251 SavePageOriginalVsSavedComparisonTest, |
1247 ::testing::Values(content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, | 1252 ::testing::Values(content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, |
1248 content::SAVE_PAGE_TYPE_AS_MHTML)); | 1253 content::SAVE_PAGE_TYPE_AS_MHTML)); |
1249 | 1254 |
1250 } // namespace | 1255 } // namespace |
OLD | NEW |