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

Unified Diff: content/browser/webui/web_ui_mojo_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, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/webui/web_ui_mojo_browsertest.cc
diff --git a/content/browser/webui/web_ui_mojo_browsertest.cc b/content/browser/webui/web_ui_mojo_browsertest.cc
index c3220264681a0a97f56acf2b6d9c35f7d701a7b1..6cca4d7c454f569d998bdd379079aa34589ed14c 100644
--- a/content/browser/webui/web_ui_mojo_browsertest.cc
+++ b/content/browser/webui/web_ui_mojo_browsertest.cc
@@ -13,6 +13,7 @@
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
+#include "base/threading/thread_restrictions.h"
#include "content/browser/webui/web_ui_controller_factory_registry.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_frame_host.h"
@@ -38,6 +39,8 @@ namespace content {
namespace {
base::FilePath GetFilePathForJSResource(const std::string& path) {
+ base::ThreadRestrictions::ScopedAllowIO allow_io_from_test_callbacks;
+
std::string binding_path = "gen/" + path + ".js";
#if defined(OS_WIN)
base::ReplaceChars(binding_path, "//", "\\", &binding_path);
@@ -53,6 +56,8 @@ bool got_message = false;
// up the generated file from disk and returns it.
bool GetResource(const std::string& id,
const WebUIDataSource::GotDataCallback& callback) {
+ base::ThreadRestrictions::ScopedAllowIO allow_io_from_test_callbacks;
+
if (id.find(".mojom") != std::string::npos) {
std::string contents;
CHECK(base::ReadFileToString(GetFilePathForJSResource(id), &contents))
@@ -198,6 +203,7 @@ bool IsGeneratedResourceAvailable(const std::string& resource_path) {
// files. If the bindings file doesn't exist assume we're on such a bot and
// pass.
// TODO(sky): remove this conditional when isolates support copying from gen.
+ base::ThreadRestrictions::ScopedAllowIO allow_io_for_file_existance_check;
const base::FilePath test_file_path(GetFilePathForJSResource(resource_path));
if (base::PathExists(test_file_path))
return true;
« no previous file with comments | « content/browser/tracing/tracing_controller_browsertest.cc ('k') | content/public/test/content_browser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698