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

Unified Diff: chrome/browser/ui/app_list/arc/arc_app_unittest.cc

Issue 2767923002: Always use an async TaskScheduler in TestBrowserThreadBundle. (Closed)
Patch Set: fix-test-error 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/ui/app_list/arc/arc_app_unittest.cc
diff --git a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
index 69c0c8a5fe1795f04b4d8c11147e59924980b0c5..1bfccd637fe4086d079ec603a7c64794f9803d04 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
@@ -43,6 +43,7 @@
#include "components/arc/test/fake_app_instance.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h"
@@ -90,8 +91,7 @@ void WaitForIconReady(ArcAppListPrefs* prefs,
// Process pending tasks. This performs multiple thread hops, so we need
// to run it continuously until it is resolved.
do {
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- base::RunLoop().RunUntilIdle();
+ content::RunAllBlockingPoolTasksUntilIdle();
} while (!base::PathExists(icon_path));
}
@@ -818,8 +818,7 @@ TEST_P(ArcAppModelBuilderTest, RequestIcons) {
// This does not result in an icon being loaded, so WaitForIconReady
// cannot be used.
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- base::RunLoop().RunUntilIdle();
+ content::RunAllBlockingPoolTasksUntilIdle();
}
}
@@ -977,8 +976,7 @@ TEST_P(ArcAppModelBuilderTest, RemoveAppCleanUpFolder) {
// Process pending tasks. This performs multiple thread hops, so we need
// to run it continuously until it is resolved.
do {
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- base::RunLoop().RunUntilIdle();
+ content::RunAllBlockingPoolTasksUntilIdle();
} while (base::PathExists(app_path));
EXPECT_FALSE(base::PathExists(app_path));
}
@@ -1112,8 +1110,7 @@ TEST_P(ArcAppModelBuilderTest, IconLoaderForShelfGroup) {
app_instance()->RefreshAppList();
app_instance()->SendRefreshAppList(std::vector<arc::mojom::AppInfo>(
fake_apps().begin(), fake_apps().begin() + 1));
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- base::RunLoop().RunUntilIdle();
+ content::RunAllBlockingPoolTasksUntilIdle();
// Store number of requests generated during the App List item creation. Same
// request will not be re-sent without clearing the request record in
@@ -1128,8 +1125,7 @@ TEST_P(ArcAppModelBuilderTest, IconLoaderForShelfGroup) {
";S.org.chromium.arc.shelf_group_id=arc_test_shelf_group;end";
app_instance()->SendInstallShortcuts(shortcuts);
const std::string shortcut_id = ArcAppTest::GetAppId(shortcuts[0]);
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- base::RunLoop().RunUntilIdle();
+ content::RunAllBlockingPoolTasksUntilIdle();
const std::string id_shortcut_exist =
arc::ArcAppShelfId("arc_test_shelf_group", app_id).ToString();
@@ -1144,8 +1140,7 @@ TEST_P(ArcAppModelBuilderTest, IconLoaderForShelfGroup) {
icon_loader.FetchImage(id_shortcut_exist);
EXPECT_EQ(1UL, delegate.update_image_cnt());
EXPECT_EQ(id_shortcut_exist, delegate.app_id());
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- base::RunLoop().RunUntilIdle();
+ content::RunAllBlockingPoolTasksUntilIdle();
const size_t shortcut_request_cnt =
app_instance()->shortcut_icon_requests().size();
EXPECT_NE(0U, shortcut_request_cnt);
@@ -1160,8 +1155,7 @@ TEST_P(ArcAppModelBuilderTest, IconLoaderForShelfGroup) {
MaybeRemoveIconRequestRecord(app_id);
icon_loader.FetchImage(id_shortcut_absent);
EXPECT_EQ(2UL, delegate.update_image_cnt());
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- base::RunLoop().RunUntilIdle();
+ content::RunAllBlockingPoolTasksUntilIdle();
EXPECT_TRUE(app_instance()->icon_requests().size() >
initial_icon_request_count);
EXPECT_EQ(shortcut_request_cnt,
@@ -1185,8 +1179,7 @@ TEST_P(ArcAppModelBuilderTest, IconLoaderWithBadIcon) {
app_instance()->RefreshAppList();
app_instance()->SendRefreshAppList(std::vector<arc::mojom::AppInfo>(
fake_apps().begin(), fake_apps().begin() + 1));
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- base::RunLoop().RunUntilIdle();
+ content::RunAllBlockingPoolTasksUntilIdle();
// Store number of requests generated during the App List item creation. Same
// request will not be re-sent without clearing the request record in
@@ -1198,8 +1191,7 @@ TEST_P(ArcAppModelBuilderTest, IconLoaderWithBadIcon) {
ArcAppIconLoader icon_loader(profile(), app_list::kListIconSize, &delegate);
icon_loader.FetchImage(app_id);
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- base::RunLoop().RunUntilIdle();
+ content::RunAllBlockingPoolTasksUntilIdle();
// Although icon file is still missing, expect no new request sent to ARC as
// them are recorded in IconRequestRecord in ArcAppListPrefs.
EXPECT_EQ(app_instance()->icon_requests().size(), initial_icon_request_count);

Powered by Google App Engine
This is Rietveld 408576698