diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-08 20:49:29 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-08 20:49:29 +0000 |
commit | 2e221ccd4a632f98e531c38696f663c83b707d1c (patch) | |
tree | c20b3babdde102fc9ff4ab0043446da543e0ffe3 /content/shell/shell_browser_main.cc | |
parent | 7ed25f83dea17c7c888f91bdd50f8e4f876daac9 (diff) | |
download | chromium_src-2e221ccd4a632f98e531c38696f663c83b707d1c.zip chromium_src-2e221ccd4a632f98e531c38696f663c83b707d1c.tar.gz chromium_src-2e221ccd4a632f98e531c38696f663c83b707d1c.tar.bz2 |
[content shell] avoid accessing the filesystem when io restrictions are enabled
BUG=111316
TEST=content_shell doesn't trigger thread io restrictions in debug mode
Review URL: https://chromiumcodereview.appspot.com/11363137
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166751 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell/shell_browser_main.cc')
-rw-r--r-- | content/shell/shell_browser_main.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/content/shell/shell_browser_main.cc b/content/shell/shell_browser_main.cc index d8fabe9..8447c9c 100644 --- a/content/shell/shell_browser_main.cc +++ b/content/shell/shell_browser_main.cc @@ -23,6 +23,7 @@ namespace { GURL GetURLForLayoutTest(const std::string& test_name, + FilePath* current_working_directory, bool* enable_pixel_dumping, std::string* expected_pixel_hash) { // A test name is formated like file:///path/to/test'--pixel-test'pixelhash @@ -56,10 +57,14 @@ GURL GetURLForLayoutTest(const std::string& test_name, #endif } FilePath local_path; - if (net::FileURLToFilePath(test_url, &local_path)) { - // We're outside of the message loop here, and this is a test. + { base::ThreadRestrictions::ScopedAllowIO allow_io; - file_util::SetCurrentDirectory(local_path.DirName()); + if (net::FileURLToFilePath(test_url, &local_path)) { + // We're outside of the message loop here, and this is a test. + file_util::SetCurrentDirectory(local_path.DirName()); + } + if (current_working_directory) + file_util::GetCurrentDirectory(current_working_directory); } return test_url; } @@ -119,10 +124,11 @@ int ShellBrowserMain(const content::MainFunctionParams& parameters) { bool enable_pixel_dumps; std::string pixel_hash; + FilePath cwd; GURL test_url = GetURLForLayoutTest( - test_string, &enable_pixel_dumps, &pixel_hash); + test_string, &cwd, &enable_pixel_dumps, &pixel_hash); if (!content::WebKitTestController::Get()->PrepareForLayoutTest( - test_url, enable_pixel_dumps, pixel_hash)) { + test_url, cwd, enable_pixel_dumps, pixel_hash)) { break; } |