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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_APP_LIST_HELPER_H_
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_APP_LIST_HELPER_H_
10 #include "base/basictypes.h"
11 #include "base/memory/singleton.h"
12 #include "sync/api/string_ordinal.h"
21 class SyncAppListHelper
{
23 // Singleton implementation.
24 static SyncAppListHelper
* GetInstance();
26 // Initializes the profiles in |test| and registers them with
27 // internal data structures.
28 void SetupIfNecessary(SyncTest
* test
);
30 // Returns true iff all existing profiles have the same app list entries
32 bool AllProfilesHaveSameAppListAsVerifier();
34 // Moves an app in |profile|.
35 void MoveApp(Profile
* profile
, size_t from
, size_t to
);
37 // Moves an app in |profile| to |folder_id|.
38 void MoveAppToFolder(Profile
* profile
,
40 const std::string
& folder_id
);
42 // Moves an app in |profile| from |folder_id| to the top level list of apps.
43 void MoveAppFromFolder(Profile
* profile
,
44 size_t index_in_folder
,
45 const std::string
& folder_id
);
47 // Copies ordinals for item matching |id| from |profile1| to test_->verifier.
48 void CopyOrdinalsToVerifier(Profile
* profile1
, const std::string
& id
);
50 // Helper function for debugging, used to log the app lists on test failures.
51 void PrintAppList(Profile
* profile
);
54 friend struct base::DefaultSingletonTraits
<SyncAppListHelper
>;
59 // Returns true iff |profile| has the same app list as |test_|->verifier()
60 // and the app list entries all have the same state.
61 bool AppListMatchesVerifier(Profile
* profile
);
63 // Helper function for debugging, logs info for an item, including the
64 // contents of any folder items.
65 void PrintItem(Profile
* profile
,
66 app_list::AppListItem
* item
,
67 const std::string
& label
);
70 bool setup_completed_
;
72 DISALLOW_COPY_AND_ASSIGN(SyncAppListHelper
);
75 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_APP_LIST_HELPER_H_