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

Side by Side Diff: content/renderer/dom_serializer_browsertest.cc

Issue 2175933002: More aggressive IO asserts in content_browsertests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use 1 less instance of ScopedAllowIO in DumpAccessibilityTestBase::RunTestForPlatform. Created 4 years, 4 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "base/threading/thread_restrictions.h"
16 #include "build/build_config.h" 17 #include "build/build_config.h"
17 #include "content/public/browser/render_view_host.h" 18 #include "content/public/browser/render_view_host.h"
18 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
19 #include "content/public/common/content_switches.h" 20 #include "content/public/common/content_switches.h"
20 #include "content/public/renderer/render_view.h" 21 #include "content/public/renderer/render_view.h"
21 #include "content/public/renderer/render_view_observer.h" 22 #include "content/public/renderer/render_view_observer.h"
22 #include "content/public/test/content_browser_test.h" 23 #include "content/public/test/content_browser_test.h"
23 #include "content/public/test/content_browser_test_utils.h" 24 #include "content/public/test/content_browser_test_utils.h"
24 #include "content/public/test/test_utils.h" 25 #include "content/public/test/test_utils.h"
25 #include "content/renderer/savable_resources.h" 26 #include "content/renderer/savable_resources.h"
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 } 678 }
678 679
679 // Serialize XML document which has all 5 built-in entities. After 680 // Serialize XML document which has all 5 built-in entities. After
680 // finishing serialization, the serialized contents should be same 681 // finishing serialization, the serialized contents should be same
681 // with original XML document. 682 // with original XML document.
682 IN_PROC_BROWSER_TEST_F(DomSerializerTests, 683 IN_PROC_BROWSER_TEST_F(DomSerializerTests,
683 SerializeXMLDocWithBuiltInEntities) { 684 SerializeXMLDocWithBuiltInEntities) {
684 base::FilePath page_file_path = 685 base::FilePath page_file_path =
685 GetTestFilePath("dom_serializer", "note.html"); 686 GetTestFilePath("dom_serializer", "note.html");
686 base::FilePath xml_file_path = GetTestFilePath("dom_serializer", "note.xml"); 687 base::FilePath xml_file_path = GetTestFilePath("dom_serializer", "note.xml");
687 // Read original contents for later comparison. 688
688 std::string original_contents; 689 std::string original_contents;
689 ASSERT_TRUE(base::ReadFileToString(xml_file_path, &original_contents)); 690 {
691 // Read original contents for later comparison.
692 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_verifications;
693 ASSERT_TRUE(base::ReadFileToString(xml_file_path, &original_contents));
694 }
695
690 // Get file URL. 696 // Get file URL.
691 GURL file_url = net::FilePathToFileURL(page_file_path); 697 GURL file_url = net::FilePathToFileURL(page_file_path);
692 GURL xml_file_url = net::FilePathToFileURL(xml_file_path); 698 GURL xml_file_url = net::FilePathToFileURL(xml_file_path);
693 ASSERT_TRUE(file_url.SchemeIsFile()); 699 ASSERT_TRUE(file_url.SchemeIsFile());
700
694 // Load the test file. 701 // Load the test file.
695 NavigateToURL(shell(), file_url); 702 NavigateToURL(shell(), file_url);
696 703
697 PostTaskToInProcessRendererAndWait( 704 PostTaskToInProcessRendererAndWait(
698 base::Bind( 705 base::Bind(
699 &DomSerializerTests::SerializeXMLDocWithBuiltInEntitiesOnRenderer, 706 &DomSerializerTests::SerializeXMLDocWithBuiltInEntitiesOnRenderer,
700 base::Unretained(this), xml_file_url, original_contents)); 707 base::Unretained(this), xml_file_url, original_contents));
701 } 708 }
702 709
703 // When serializing DOM, we add MOTW declaration before html tag. 710 // When serializing DOM, we add MOTW declaration before html tag.
704 IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeHTMLDOMWithAddingMOTW) { 711 IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeHTMLDOMWithAddingMOTW) {
705 base::FilePath page_file_path = 712 base::FilePath page_file_path =
706 GetTestFilePath("dom_serializer", "youtube_2.htm"); 713 GetTestFilePath("dom_serializer", "youtube_2.htm");
707 // Read original contents for later comparison . 714
708 std::string original_contents; 715 std::string original_contents;
709 ASSERT_TRUE(base::ReadFileToString(page_file_path, &original_contents)); 716 {
717 // Read original contents for later comparison .
718 base::ThreadRestrictions::ScopedAllowIO allow_io_for_test_verifications;
719 ASSERT_TRUE(base::ReadFileToString(page_file_path, &original_contents));
720 }
721
710 // Get file URL. 722 // Get file URL.
711 GURL file_url = net::FilePathToFileURL(page_file_path); 723 GURL file_url = net::FilePathToFileURL(page_file_path);
712 ASSERT_TRUE(file_url.SchemeIsFile()); 724 ASSERT_TRUE(file_url.SchemeIsFile());
713 725
714 // Load the test file. 726 // Load the test file.
715 NavigateToURL(shell(), file_url); 727 NavigateToURL(shell(), file_url);
716 728
717 PostTaskToInProcessRendererAndWait( 729 PostTaskToInProcessRendererAndWait(
718 base::Bind( 730 base::Bind(
719 &DomSerializerTests::SerializeHTMLDOMWithAddingMOTWOnRenderer, 731 &DomSerializerTests::SerializeHTMLDOMWithAddingMOTWOnRenderer,
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 NavigateToURL(shell(), file_url); 871 NavigateToURL(shell(), file_url);
860 872
861 PostTaskToInProcessRendererAndWait( 873 PostTaskToInProcessRendererAndWait(
862 base::Bind( 874 base::Bind(
863 &DomSerializerTests:: 875 &DomSerializerTests::
864 SubResourceForElementsInNonHTMLNamespaceOnRenderer, 876 SubResourceForElementsInNonHTMLNamespaceOnRenderer,
865 base::Unretained(this), file_url)); 877 base::Unretained(this), file_url));
866 } 878 }
867 879
868 } // namespace content 880 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/content_browser_test_utils.cc ('k') | content/test/content_browser_test_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698