| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_APP_LIST_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_APP_LIST_HELPER_H_ |
| 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_APP_LIST_HELPER_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_APP_LIST_HELPER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 class SyncAppListHelper { | 23 class SyncAppListHelper { |
| 24 public: | 24 public: |
| 25 // Singleton implementation. | 25 // Singleton implementation. |
| 26 static SyncAppListHelper* GetInstance(); | 26 static SyncAppListHelper* GetInstance(); |
| 27 | 27 |
| 28 // Initializes the profiles in |test| and registers them with | 28 // Initializes the profiles in |test| and registers them with |
| 29 // internal data structures. | 29 // internal data structures. |
| 30 void SetupIfNecessary(SyncTest* test); | 30 void SetupIfNecessary(SyncTest* test); |
| 31 | 31 |
| 32 // Returns true iff all existing profiles have the same app list entries | 32 // Returns true iff all existing profiles have the same app list entries. |
| 33 // as the verifier. | 33 bool AllProfilesHaveSameAppList(); |
| 34 bool AllProfilesHaveSameAppListAsVerifier(); | |
| 35 | 34 |
| 36 // Moves an app in |profile|. | 35 // Moves an app in |profile|. |
| 37 void MoveApp(Profile* profile, size_t from, size_t to); | 36 void MoveApp(Profile* profile, size_t from, size_t to); |
| 38 | 37 |
| 39 // Moves an app in |profile| to |folder_id|. | 38 // Moves an app in |profile| to |folder_id|. |
| 40 void MoveAppToFolder(Profile* profile, | 39 void MoveAppToFolder(Profile* profile, |
| 41 size_t index, | 40 size_t index, |
| 42 const std::string& folder_id); | 41 const std::string& folder_id); |
| 43 | 42 |
| 44 // Moves an app in |profile| from |folder_id| to the top level list of apps. | 43 // Moves an app in |profile| from |folder_id| to the top level list of apps. |
| 45 void MoveAppFromFolder(Profile* profile, | 44 void MoveAppFromFolder(Profile* profile, |
| 46 size_t index_in_folder, | 45 size_t index_in_folder, |
| 47 const std::string& folder_id); | 46 const std::string& folder_id); |
| 48 | 47 |
| 49 // Copies ordinals for item matching |id| from |profile1| to test_->verifier. | |
| 50 void CopyOrdinalsToVerifier(Profile* profile1, const std::string& id); | |
| 51 | |
| 52 // Helper function for debugging, used to log the app lists on test failures. | 48 // Helper function for debugging, used to log the app lists on test failures. |
| 53 void PrintAppList(Profile* profile); | 49 void PrintAppList(Profile* profile); |
| 54 | 50 |
| 55 private: | 51 private: |
| 56 friend struct base::DefaultSingletonTraits<SyncAppListHelper>; | 52 friend struct base::DefaultSingletonTraits<SyncAppListHelper>; |
| 57 | 53 |
| 58 SyncAppListHelper(); | 54 SyncAppListHelper(); |
| 59 ~SyncAppListHelper(); | 55 ~SyncAppListHelper(); |
| 60 | 56 |
| 61 // Returns true iff |profile| has the same app list as |test_|->verifier() | 57 // Returns true iff |profile1| has the same app list as |profile2| |
| 62 // and the app list entries all have the same state. | 58 // and the app list entries all have the same state. |
| 63 bool AppListMatchesVerifier(Profile* profile); | 59 bool AppListMatch(Profile* profile1, Profile* profile2); |
| 64 | 60 |
| 65 // Helper function for debugging, logs info for an item, including the | 61 // Helper function for debugging, logs info for an item, including the |
| 66 // contents of any folder items. | 62 // contents of any folder items. |
| 67 void PrintItem(Profile* profile, | 63 void PrintItem(Profile* profile, |
| 68 app_list::AppListItem* item, | 64 app_list::AppListItem* item, |
| 69 const std::string& label); | 65 const std::string& label); |
| 70 | 66 |
| 71 SyncTest* test_; | 67 SyncTest* test_; |
| 72 bool setup_completed_; | 68 bool setup_completed_; |
| 73 | 69 |
| 74 DISALLOW_COPY_AND_ASSIGN(SyncAppListHelper); | 70 DISALLOW_COPY_AND_ASSIGN(SyncAppListHelper); |
| 75 }; | 71 }; |
| 76 | 72 |
| 77 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_APP_LIST_HELPER_H_ | 73 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_APP_LIST_HELPER_H_ |
| OLD | NEW |