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

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

Issue 1709293002: Add support for CSS unicod encoding to the text codec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a css test. Created 4 years, 8 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
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 <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
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\""));
738 } 743 }
Łukasz Anforowicz 2016/04/27 04:28:12 I am happy with the test above, but could you plea
bburns 2016/04/27 20:24:21 I tried adding this test, but it passes both with
Łukasz Anforowicz 2016/04/27 20:25:47 Acknowledged.
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()),
748 loop_runner->QuitClosure()); 753 loop_runner->QuitClosure());
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/save_page/1.css » ('j') | third_party/WebKit/Source/wtf/text/TextCodec.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698