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

Side by Side Diff: content/test/webui_resource_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
« no previous file with comments | « content/test/ppapi/ppapi_test.cc ('k') | net/cert/test_root_certs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/threading/thread_restrictions.h"
9 #include "content/grit/content_resources.h" 10 #include "content/grit/content_resources.h"
10 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
11 #include "content/public/common/content_paths.h" 12 #include "content/public/common/content_paths.h"
12 #include "content/public/test/browser_test_utils.h" 13 #include "content/public/test/browser_test_utils.h"
13 #include "content/public/test/content_browser_test.h" 14 #include "content/public/test/content_browser_test.h"
14 #include "content/public/test/content_browser_test_utils.h" 15 #include "content/public/test/content_browser_test_utils.h"
15 #include "content/shell/browser/shell.h" 16 #include "content/shell/browser/shell.h"
16 #include "net/base/filename_util.h" 17 #include "net/base/filename_util.h"
17 #include "ui/resources/grit/webui_resources.h" 18 #include "ui/resources/grit/webui_resources.h"
18 19
19 namespace content { 20 namespace content {
20 21
21 class WebUIResourceBrowserTest : public ContentBrowserTest { 22 class WebUIResourceBrowserTest : public ContentBrowserTest {
22 public: 23 public:
23 WebUIResourceBrowserTest() {} 24 WebUIResourceBrowserTest() {}
24 ~WebUIResourceBrowserTest() override {} 25 ~WebUIResourceBrowserTest() override {}
25 26
26 // Runs all test functions in |file|, waiting for them to complete. 27 // Runs all test functions in |file|, waiting for them to complete.
27 void RunTest(const base::FilePath& file) { 28 void RunTest(const base::FilePath& file) {
28 ASSERT_TRUE(PathExists(file)); 29 {
30 base::ThreadRestrictions::ScopedAllowIO allow_io_for_file_existance_check;
31 ASSERT_TRUE(PathExists(file));
32 }
33
29 NavigateToURL(shell(), net::FilePathToFileURL(file)); 34 NavigateToURL(shell(), net::FilePathToFileURL(file));
30 35
31 content::WebContents* web_contents = shell()->web_contents(); 36 content::WebContents* web_contents = shell()->web_contents();
32 ASSERT_TRUE(web_contents); 37 ASSERT_TRUE(web_contents);
33 EXPECT_TRUE(ExecuteWebUIResourceTest(web_contents, include_libraries_)); 38 EXPECT_TRUE(ExecuteWebUIResourceTest(web_contents, include_libraries_));
34 } 39 }
35 40
36 void RunMediaInternalsTest(const base::FilePath::CharType* file) { 41 void RunMediaInternalsTest(const base::FilePath::CharType* file) {
37 AddLibrary(IDR_WEBUI_JS_CR); 42 AddLibrary(IDR_WEBUI_JS_CR);
38 AddLibrary(IDR_MEDIA_INTERNALS_JS); 43 AddLibrary(IDR_MEDIA_INTERNALS_JS);
39 44 RunTest(GetTestFilePath("media", "webui").Append(file));
40 base::FilePath path;
41 PathService::Get(DIR_TEST_DATA, &path);
42 RunTest(path.Append(FILE_PATH_LITERAL("media"))
43 .Append(FILE_PATH_LITERAL("webui"))
44 .Append(file));
45 } 45 }
46 46
47 // Queues the library corresponding to |resource_id| for injection into the 47 // Queues the library corresponding to |resource_id| for injection into the
48 // test. The code injection is performed post-load, so any common test 48 // test. The code injection is performed post-load, so any common test
49 // initialization that depends on the library should be placed in a setUp 49 // initialization that depends on the library should be placed in a setUp
50 // function. 50 // function.
51 void AddLibrary(int resource_id) { 51 void AddLibrary(int resource_id) {
52 include_libraries_.push_back(resource_id); 52 include_libraries_.push_back(resource_id);
53 } 53 }
54 54
(...skipping 10 matching lines...) Expand all
65 65
66 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, MediaInternals_PlayerInfo) { 66 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, MediaInternals_PlayerInfo) {
67 RunMediaInternalsTest(FILE_PATH_LITERAL("player_info_test.html")); 67 RunMediaInternalsTest(FILE_PATH_LITERAL("player_info_test.html"));
68 } 68 }
69 69
70 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, MediaInternals_Manager) { 70 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, MediaInternals_Manager) {
71 RunMediaInternalsTest(FILE_PATH_LITERAL("manager_test.html")); 71 RunMediaInternalsTest(FILE_PATH_LITERAL("manager_test.html"));
72 } 72 }
73 73
74 } // namespace content 74 } // namespace content
OLDNEW
« no previous file with comments | « content/test/ppapi/ppapi_test.cc ('k') | net/cert/test_root_certs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698