Chromium Code Reviews| Index: chrome/browser/sync/test/integration/sync_test.cc |
| diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc |
| index 64cc0210c74bf66ebdc6ef7fc0dea9b4d2217b45..0e7de234ad660bda1109b590fa885c4cba1c82bf 100644 |
| --- a/chrome/browser/sync/test/integration/sync_test.cc |
| +++ b/chrome/browser/sync/test/integration/sync_test.cc |
| @@ -89,7 +89,10 @@ |
| #include "url/gurl.h" |
| #if defined(OS_CHROMEOS) |
| +#include "chrome/browser/sync/test/integration/sync_arc_package_helper.h" |
| +#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h" |
| #include "chromeos/chromeos_switches.h" |
| +#include "components/arc/arc_util.h" |
| #endif |
| using browser_sync::ProfileSyncService; |
| @@ -213,7 +216,8 @@ SyncTest::SyncTest(TestType test_type) |
| num_clients_(-1), |
| use_verifier_(true), |
| notifications_enabled_(true), |
| - create_gaia_account_at_runtime_(false) { |
| + create_gaia_account_at_runtime_(false), |
| + sync_arc_helper_(nullptr) { |
| sync_datatype_helper::AssociateWithTest(this); |
| switch (test_type_) { |
| case SINGLE_CLIENT: |
| @@ -292,12 +296,22 @@ void SyncTest::TearDown() { |
| fake_server_.reset(); |
| } |
| +void SyncTest::SetUpOnMainThread() { |
| +#if defined(OS_CHROMEOS) |
| + const auto* cl = base::CommandLine::ForCurrentProcess(); |
| + // Sets up for ARC_PACKAGE. |
| + if (!cl->HasSwitch(switches::kSupervisedUserId)) |
|
Gang Wu
2017/03/16 18:40:30
add this because "Supervised users are not support
skym
2017/03/16 23:27:19
Can you put that into a comment?
Gang Wu
2017/03/17 19:23:23
Done.
|
| + ArcAppListPrefsFactory::SetFactoryForSyncTest(); |
| +#endif |
| +} |
| + |
| void SyncTest::SetUpCommandLine(base::CommandLine* cl) { |
| AddTestSwitches(cl); |
| AddOptionalTypesToCommandLine(cl); |
| #if defined(OS_CHROMEOS) |
| cl->AppendSwitch(chromeos::switches::kIgnoreUserProfileMappingForTests); |
| + arc::SetArcAvailableCommandLineForTesting(cl); |
| #endif |
| } |
| @@ -531,6 +545,18 @@ bool SyncTest::SetupClients() { |
| user_data_dir.Append(FILE_PATH_LITERAL("Verifier")), num_clients_); |
| WaitForDataModels(verifier()); |
| } |
| + |
| +#if defined(OS_CHROMEOS) |
| + // Init SyncArcPackageHelper to ensure that the arc services are initialized |
| + // for each Profile. |
| + const auto* cl = base::CommandLine::ForCurrentProcess(); |
| + if (!cl->HasSwitch(switches::kSupervisedUserId)) { |
|
skym
2017/03/16 23:27:19
I've seen this check before! Can you unify them? A
Gang Wu
2017/03/17 19:23:23
cannot combine two code together, ArcAppListPrefsF
|
| + sync_arc_helper_ = arc::SyncArcPackageHelper::GetInstance(); |
| + if (!sync_arc_helper_) |
| + return false; |
| + } |
| +#endif |
| + |
| // Error cases are all handled by LOG(FATAL) messages. So there is not really |
| // a case that returns false. In case we failed to create a verifier profile, |
| // any call to the verifier() would fail. |