Chromium Code Reviews| 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 AllProfilesHaveSameArcPackageDetails() { | |
| 18 return SyncArcPackageHelper::GetInstance() | |
| 19 ->AllProfilesHaveSamePackageDetails(); | |
| 20 } | |
| 21 | |
| 22 } // namespace | |
| 23 | |
| 24 class SingleClientArcPackageSyncTest : public SyncTest { | |
| 25 public: | |
| 26 SingleClientArcPackageSyncTest() | |
| 27 : SyncTest(SINGLE_CLIENT), 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 TearDownOnMainThread() override { | |
| 42 sync_helper_->CleanUp(); | |
|
Luis Héctor Chávez
2016/08/01 18:03:40
For symmetry, can |sync_helper_| be initialized in
lgcheng
2016/08/01 18:14:18
Done.
| |
| 43 SyncTest::TearDownOnMainThread(); | |
| 44 } | |
| 45 | |
| 46 SyncArcPackageHelper* sync_helper() { return sync_helper_; } | |
| 47 | |
| 48 private: | |
| 49 SyncArcPackageHelper* sync_helper_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(SingleClientArcPackageSyncTest); | |
| 52 }; | |
| 53 | |
| 54 IN_PROC_BROWSER_TEST_F(SingleClientArcPackageSyncTest, ArcPackageEmpty) { | |
| 55 ASSERT_TRUE(SetupSync()); | |
| 56 | |
| 57 ASSERT_TRUE(AllProfilesHaveSameArcPackageDetails()); | |
| 58 | |
| 59 } | |
| 60 | |
| 61 IN_PROC_BROWSER_TEST_F(SingleClientArcPackageSyncTest, | |
| 62 ArcPackageInstallSomePackages) { | |
| 63 ASSERT_TRUE(SetupSync()); | |
| 64 | |
| 65 constexpr size_t kNumPackages = 5; | |
| 66 for (size_t i = 0; i < kNumPackages; ++i) { | |
| 67 sync_helper()->InstallPackageWithIndex(GetProfile(0), i); | |
| 68 sync_helper()->InstallPackageWithIndex(verifier(), i); | |
| 69 } | |
| 70 | |
| 71 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); | |
| 72 ASSERT_TRUE(AllProfilesHaveSameArcPackageDetails()); | |
| 73 } | |
| 74 | |
| 75 } // namespace arc | |
| OLD | NEW |