| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_ARC_PACKAGE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_ARC_PACKAGE_HELPER_H_ |
| 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_ARC_PACKAGE_HELPER_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_ARC_PACKAGE_HELPER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <unordered_map> | 10 #include <unordered_map> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "components/arc/common/app.mojom.h" | 14 #include "components/arc/common/app.mojom.h" |
| 15 | 15 |
| 16 class Profile; | 16 class Profile; |
| 17 class SyncTest; | 17 class SyncTest; |
| 18 | 18 |
| 19 namespace arc { | 19 namespace arc { |
| 20 class FakeAppInstance; | 20 class FakeAppInstance; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace chromeos { | |
| 24 class ScopedUserManagerEnabler; | |
| 25 } | |
| 26 | |
| 27 namespace arc { | 23 namespace arc { |
| 28 | 24 |
| 29 class SyncArcPackageHelper { | 25 class SyncArcPackageHelper { |
| 30 public: | 26 public: |
| 31 static SyncArcPackageHelper* GetInstance(); | 27 static SyncArcPackageHelper* GetInstance(); |
| 32 | 28 |
| 33 void SetupTest(SyncTest* test); | 29 void SetupTest(SyncTest* test); |
| 34 | 30 |
| 35 void CleanUp(); | |
| 36 | |
| 37 void InstallPackageWithIndex(Profile* profile, size_t id); | 31 void InstallPackageWithIndex(Profile* profile, size_t id); |
| 38 | 32 |
| 39 void UninstallPackageWithIndex(Profile* profile, size_t id); | 33 void UninstallPackageWithIndex(Profile* profile, size_t id); |
| 40 | 34 |
| 41 void ClearPackages(Profile* profile); | 35 void ClearPackages(Profile* profile); |
| 42 | 36 |
| 43 bool AllProfilesHaveSamePackages(); | 37 bool AllProfilesHaveSamePackages(); |
| 44 | 38 |
| 45 bool AllProfilesHaveSamePackageDetails(); | 39 bool AllProfilesHaveSamePackageDetails(); |
| 46 | 40 |
| 47 void SetupArcService(Profile* profile, size_t id); | 41 void SetupArcService(Profile* profile); |
| 48 | 42 |
| 49 private: | 43 private: |
| 50 friend struct base::DefaultSingletonTraits<SyncArcPackageHelper>; | 44 friend struct base::DefaultSingletonTraits<SyncArcPackageHelper>; |
| 51 | 45 |
| 52 SyncArcPackageHelper(); | 46 SyncArcPackageHelper(); |
| 53 ~SyncArcPackageHelper(); | 47 ~SyncArcPackageHelper(); |
| 54 | 48 |
| 55 void InstallPackage(Profile* profile, const mojom::ArcPackageInfo& package); | 49 void InstallPackage(Profile* profile, const mojom::ArcPackageInfo& package); |
| 56 | 50 |
| 57 void UninstallPackage(Profile* profile, const std::string& package_name); | 51 void UninstallPackage(Profile* profile, const std::string& package_name); |
| 58 | 52 |
| 59 // Returns true if |profile1| has the same arc packages as |profile2|. | 53 // Returns true if |profile1| has the same arc packages as |profile2|. |
| 60 bool ArcPackagesMatch(Profile* profile1, Profile* profile2); | 54 bool ArcPackagesMatch(Profile* profile1, Profile* profile2); |
| 61 | 55 |
| 62 // Returns true if |profile1| has the same arc packages and detail package | 56 // Returns true if |profile1| has the same arc packages and detail package |
| 63 // informaton as |profile2|. | 57 // informaton as |profile2|. |
| 64 bool ArcPackageDetailsMatch(Profile* profile1, Profile* profile2); | 58 bool ArcPackageDetailsMatch(Profile* profile1, Profile* profile2); |
| 65 | 59 |
| 66 SyncTest* test_; | 60 SyncTest* test_; |
| 67 bool setup_completed_; | 61 bool setup_completed_; |
| 68 | 62 |
| 69 std::unordered_map<Profile*, std::unique_ptr<FakeAppInstance>> instance_map_; | 63 std::unordered_map<Profile*, std::unique_ptr<FakeAppInstance>> instance_map_; |
| 70 | 64 |
| 71 std::unique_ptr<chromeos::ScopedUserManagerEnabler> user_manager_enabler_; | |
| 72 | |
| 73 DISALLOW_COPY_AND_ASSIGN(SyncArcPackageHelper); | 65 DISALLOW_COPY_AND_ASSIGN(SyncArcPackageHelper); |
| 74 }; | 66 }; |
| 75 | 67 |
| 76 } // namespace arc | 68 } // namespace arc |
| 77 | 69 |
| 78 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_ARC_PACKAGE_HELPER_H_ | 70 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_ARC_PACKAGE_HELPER_H_ |
| OLD | NEW |