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

Unified Diff: chrome/browser/extensions/activity_log/counting_policy_unittest.cc

Issue 2980503002: [Extensions][TaskScheduler] Update ActivityLog for scheduling migration (Closed)
Patch Set: . Created 3 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: chrome/browser/extensions/activity_log/counting_policy_unittest.cc
diff --git a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc
index d6b413137975e04c83f86a4f90ac6a872c1c33cf..eec634612e937e56081daec3f531152a1d5e0ace 100644
--- a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc
+++ b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc
@@ -26,6 +26,7 @@
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/activity_log/activity_log.h"
+#include "chrome/browser/extensions/activity_log/activity_log_task_runner.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/common/chrome_constants.h"
@@ -43,8 +44,6 @@
#include "chrome/browser/chromeos/settings/device_settings_service.h"
#endif
-using content::BrowserThread;
-
namespace extensions {
class CountingPolicyTest : public testing::Test {
@@ -72,12 +71,13 @@ class CountingPolicyTest : public testing::Test {
base::RunLoop().RunUntilIdle();
}
- // Wait for the task queue for the specified thread to empty.
- void WaitOnThread(const BrowserThread::ID& thread) {
- BrowserThread::PostTaskAndReply(
- thread, FROM_HERE, base::BindOnce(&base::DoNothing),
- base::MessageLoop::current()->QuitWhenIdleClosure());
- base::RunLoop().Run();
+ // Waits for the task queue for the activity log sequence to empty.
+ void WaitOnActivityLogSequence() {
+ base::RunLoop run_loop;
+ GetActivityLogTaskRunner()->PostTaskAndReply(
+ FROM_HERE, base::BindOnce(&base::DoNothing),
+ run_loop.QuitWhenIdleClosure());
+ run_loop.Run();
}
// A wrapper function for CheckReadFilteredData, so that we don't need to
@@ -773,7 +773,7 @@ TEST_F(CountingPolicyTest, StringTableCleaning) {
&CountingPolicyTest::CheckStringTableSizes,
3,
1);
- WaitOnThread(BrowserThread::DB);
+ WaitOnActivityLogSequence();
// Trigger a cleaning. The oldest action is expired when we submit a
// duplicate of the newer action. After this, there should be two strings
@@ -786,7 +786,7 @@ TEST_F(CountingPolicyTest, StringTableCleaning) {
&CountingPolicyTest::CheckStringTableSizes,
2,
0);
- WaitOnThread(BrowserThread::DB);
+ WaitOnActivityLogSequence();
policy->Close();
}
@@ -884,7 +884,7 @@ TEST_F(CountingPolicyTest, EarlyFlush) {
}
policy->ScheduleAndForget(policy, &CountingPolicyTest::CheckQueueSize);
- WaitOnThread(BrowserThread::DB);
+ WaitOnActivityLogSequence();
policy->Close();
}
@@ -903,7 +903,7 @@ TEST_F(CountingPolicyTest, CapReturns) {
}
policy->Flush();
- WaitOnThread(BrowserThread::DB);
+ WaitOnActivityLogSequence();
CheckReadFilteredData(
policy,

Powered by Google App Engine
This is Rietveld 408576698