Chromium Code Reviews| Index: chrome/browser/sync/test/integration/single_client_arc_package_sync_test.cc |
| diff --git a/chrome/browser/sync/test/integration/single_client_arc_package_sync_test.cc b/chrome/browser/sync/test/integration/single_client_arc_package_sync_test.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9e4063fb45c2e20f20d95da4e5672f4b8d28ea78 |
| --- /dev/null |
| +++ b/chrome/browser/sync/test/integration/single_client_arc_package_sync_test.cc |
| @@ -0,0 +1,75 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/sync/test/integration/sync_arc_package_helper.h" |
| +#include "chrome/browser/sync/test/integration/sync_integration_test_util.h" |
| +#include "chrome/browser/sync/test/integration/sync_test.h" |
| +#include "chrome/browser/ui/app_list/arc/arc_package_syncable_service.h" |
| + |
| +using sync_integration_test_util::AwaitCommitActivityCompletion; |
| + |
| +namespace arc { |
| + |
| +namespace { |
| + |
| +bool AllProfilesHaveSameArcPackageDetails() { |
| + return SyncArcPackageHelper::GetInstance() |
| + ->AllProfilesHaveSamePackageDetails(); |
| +} |
| + |
| +} // namespace |
| + |
| +class SingleClientArcPackageSyncTest : public SyncTest { |
| + public: |
| + SingleClientArcPackageSyncTest() |
| + : SyncTest(SINGLE_CLIENT), sync_helper_(nullptr) {} |
| + |
| + ~SingleClientArcPackageSyncTest() override {} |
| + |
| + bool SetupClients() override { |
| + if (!SyncTest::SetupClients()) |
| + return false; |
| + |
| + // Init SyncArcPackageHelper to ensure that the arc services are initialized |
| + // for each Profile. |
| + sync_helper_ = SyncArcPackageHelper::GetInstance(); |
| + return sync_helper_ != nullptr; |
| + } |
| + |
| + void CleanUp() { sync_helper_->CleanUp(); } |
| + |
| + SyncArcPackageHelper* sync_helper() { return sync_helper_; } |
| + |
| + private: |
| + SyncArcPackageHelper* sync_helper_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SingleClientArcPackageSyncTest); |
| +}; |
| + |
| +IN_PROC_BROWSER_TEST_F(SingleClientArcPackageSyncTest, ArcPackageEmpty) { |
| + ASSERT_TRUE(SetupSync()); |
| + |
| + ASSERT_TRUE(AllProfilesHaveSameArcPackageDetails()); |
| + |
| + CleanUp(); |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(SingleClientArcPackageSyncTest, |
| + ArcPackageInstallSomePackages) { |
| + ASSERT_TRUE(SetupSync()); |
| + |
| + const size_t kNumPackages = 5; |
|
Luis Héctor Chávez
2016/07/25 20:57:24
nit: constexpr
lgcheng
2016/07/25 21:37:28
Done.
|
| + for (size_t i = 0; i < kNumPackages; ++i) { |
| + sync_helper()->InstallPackageWithIndex(GetProfile(0), i); |
| + sync_helper()->InstallPackageWithIndex(verifier(), i); |
| + } |
| + |
| + ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); |
| + ASSERT_TRUE(AllProfilesHaveSameArcPackageDetails()); |
| + |
| + CleanUp(); |
| +} |
| + |
| +} // namespace arc |