| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/profiles/profile.h" |
| 6 #include "chrome/browser/sync/test/integration/sync_arc_package_helper.h" |
| 7 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" |
| 8 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 9 #include "chrome/browser/ui/app_list/arc/arc_package_syncable_service.h" |
| 10 |
| 11 using sync_integration_test_util::AwaitCommitActivityCompletion; |
| 12 |
| 13 namespace arc { |
| 14 |
| 15 namespace { |
| 16 |
| 17 bool AllProfilesHaveSameArcPackageDetail() { |
| 18 return SyncArcPackageHelper::GetInstance()-> |
| 19 AllProfilesHaveSamePackageDetail(); |
| 20 } |
| 21 |
| 22 } // namespace |
| 23 |
| 24 class SingleClientArcPackageSyncTest : public SyncTest { |
| 25 public: |
| 26 SingleClientArcPackageSyncTest() : SyncTest(SINGLE_CLIENT), |
| 27 sync_helper_(nullptr) {} |
| 28 |
| 29 ~SingleClientArcPackageSyncTest() override {} |
| 30 |
| 31 bool SetupClients() override { |
| 32 if (!SyncTest::SetupClients()) |
| 33 return false; |
| 34 |
| 35 // Init SyncArcPackageHelper to ensure that the arc services are initialized |
| 36 // for each Profile. |
| 37 sync_helper_ = SyncArcPackageHelper::GetInstance(); |
| 38 return sync_helper_ != nullptr; |
| 39 } |
| 40 |
| 41 void ClearUp() { |
| 42 sync_helper_->ClearUp(); |
| 43 } |
| 44 |
| 45 SyncArcPackageHelper* sync_helper() { return sync_helper_; } |
| 46 private: |
| 47 SyncArcPackageHelper* sync_helper_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(SingleClientArcPackageSyncTest); |
| 50 }; |
| 51 |
| 52 IN_PROC_BROWSER_TEST_F(SingleClientArcPackageSyncTest, ArcPackageEmpty) { |
| 53 ASSERT_TRUE(SetupSync()); |
| 54 |
| 55 ASSERT_TRUE(AllProfilesHaveSameArcPackageDetail()); |
| 56 |
| 57 ClearUp(); |
| 58 } |
| 59 |
| 60 IN_PROC_BROWSER_TEST_F(SingleClientArcPackageSyncTest, |
| 61 ArcPackageInstallSomePackages) { |
| 62 ASSERT_TRUE(SetupSync()); |
| 63 |
| 64 const int kNumPackage = 5; |
| 65 for (int i = 0; i < kNumPackage; ++i) { |
| 66 sync_helper()->InstallPackageWithIndex(GetProfile(0), i); |
| 67 sync_helper()->InstallPackageWithIndex(verifier(), i); |
| 68 } |
| 69 |
| 70 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); |
| 71 ASSERT_TRUE(AllProfilesHaveSameArcPackageDetail()); |
| 72 |
| 73 ClearUp(); |
| 74 } |
| 75 |
| 76 } // namespace arc |
| OLD | NEW |