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

Unified Diff: chrome/browser/sync/test/integration/printers_helper.cc

Issue 2799103002: Enable printers sync_integration_tests on chromeos (Closed)
Patch Set: add todo 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
« no previous file with comments | « no previous file | chrome/browser/sync/test/integration/single_client_printers_sync_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/test/integration/printers_helper.cc
diff --git a/chrome/browser/sync/test/integration/printers_helper.cc b/chrome/browser/sync/test/integration/printers_helper.cc
index 084e1d02ae2293e88a6eed2792136d7bf88200b0..c098e4fdc5c7b88029b3a90061f150f966c0e0bb 100644
--- a/chrome/browser/sync/test/integration/printers_helper.cc
+++ b/chrome/browser/sync/test/integration/printers_helper.cc
@@ -13,10 +13,12 @@
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
+#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/chromeos/printing/printers_manager.h"
#include "chrome/browser/chromeos/printing/printers_manager_factory.h"
#include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
+#include "content/public/browser/browser_thread.h"
using sync_datatype_helper::test;
@@ -65,6 +67,24 @@ std::string PrinterId(int index) {
return base::StringPrintf("printer%d", index);
}
+chromeos::PrintersManager* GetPrinterStore(content::BrowserContext* context) {
+ chromeos::PrintersManager* manager =
+ chromeos::PrintersManagerFactory::GetForBrowserContext(context);
+
+ // TODO(sync): crbug.com/709094: Remove all of this once the bug is fixed.
+ // Must wait for ModelTypeStore initialization.
+ // Since PrintersManagerFactory::BuildServiceInstanceFor() uses
+ // content::BrowserThread::GetBlockingPool() to schedule ModelTypeStore
+ // initialization, tests need to wait for initialization to be completed and
+ // sent ModelTypeStore to UI thread.
+ content::BrowserThread::GetBlockingPool()->FlushForTesting();
+ // Wait for UI thread task completion to make sure PrintersSyncBridge received
+ // ModelTypeStore.
+ base::RunLoop().RunUntilIdle();
+
+ return manager;
+}
+
} // namespace
void AddPrinter(chromeos::PrintersManager* manager,
@@ -107,20 +127,14 @@ chromeos::Printer CreateTestPrinter(int index) {
chromeos::PrintersManager* GetVerifierPrinterStore() {
chromeos::PrintersManager* manager =
- chromeos::PrintersManagerFactory::GetForBrowserContext(
- sync_datatype_helper::test()->verifier());
- // Must wait for ModelTypeStore initialization.
- base::RunLoop().RunUntilIdle();
+ GetPrinterStore(sync_datatype_helper::test()->verifier());
return manager;
}
chromeos::PrintersManager* GetPrinterStore(int index) {
chromeos::PrintersManager* manager =
- chromeos::PrintersManagerFactory::GetForBrowserContext(
- sync_datatype_helper::test()->GetProfile(index));
- // Must wait for ModelTypeStore initialization.
- base::RunLoop().RunUntilIdle();
+ GetPrinterStore(sync_datatype_helper::test()->GetProfile(index));
return manager;
}
« no previous file with comments | « no previous file | chrome/browser/sync/test/integration/single_client_printers_sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698