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

Unified Diff: chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc

Issue 2835233002: Fix integration tests in src/chrome and src/extensions so that we can turn on IO thread checks wi... (Closed)
Patch Set: ready for review Created 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
index 13f90fe103ece59713df1bbb0cf5f466dd58de5a..1a4cb53507f92e725c45badd30bdcaa2a066a476 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
@@ -19,6 +19,7 @@
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
+#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "chrome/browser/download/download_file_icon_extractor.h"
#include "chrome/browser/download/download_service.h"
@@ -695,6 +696,7 @@ class HTML5FileWriter {
const storage::FileSystemURL& path,
const char* data,
int length) {
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
// Create a temp file.
base::FilePath temp_file;
if (!base::CreateTemporaryFile(&temp_file) ||
@@ -1050,9 +1052,12 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
base::FilePath real_path = all_downloads[0]->GetTargetFilePath();
base::FilePath fake_path = all_downloads[1]->GetTargetFilePath();
- EXPECT_EQ(0, base::WriteFile(real_path, "", 0));
- ASSERT_TRUE(base::PathExists(real_path));
- ASSERT_FALSE(base::PathExists(fake_path));
+ {
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
+ EXPECT_EQ(0, base::WriteFile(real_path, "", 0));
+ ASSERT_TRUE(base::PathExists(real_path));
+ ASSERT_FALSE(base::PathExists(fake_path));
+ }
for (DownloadManager::DownloadVector::iterator iter = all_downloads.begin();
iter != all_downloads.end();
@@ -2582,6 +2587,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
" \"previous\": \"in_progress\","
" \"current\": \"complete\"}}]",
result_id)));
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
std::string disk_data;
EXPECT_TRUE(base::ReadFileToString(item->GetTargetFilePath(), &disk_data));
EXPECT_STREQ(kPayloadData, disk_data.c_str());

Powered by Google App Engine
This is Rietveld 408576698