Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: chrome/test/live_sync/apps_helper.cc

Issue 7599019: Allow sync integration tests to operate on multiple datatypes: Apps, Extensions, Themes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix indents Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/live_sync/apps_helper.h ('k') | chrome/test/live_sync/extensions_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 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/test/live_sync/apps_helper.h"
6
7 #include "base/logging.h"
8 #include "base/string_number_conversions.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/extensions/extension.h"
11 #include "chrome/test/live_sync/sync_datatype_helper.h"
12 #include "chrome/test/live_sync/sync_extension_helper.h"
13
14 using sync_datatype_helper::test;
15
16 namespace {
17
18 std::string CreateFakeAppName(int index) {
19 return "fakeapp" + base::IntToString(index);
20 }
21
22 } // namespace
23
24 namespace apps_helper {
25
26 bool HasSameAppsAsVerifier(int index) {
27 // TODO(akalin): We may want to filter out non-apps for some tests.
28 return SyncExtensionHelper::GetInstance()->ExtensionStatesMatch(
29 test()->GetProfile(index), test()->verifier());
30 }
31
32 bool AllProfilesHaveSameAppsAsVerifier() {
33 for (int i = 0; i < test()->num_clients(); ++i) {
34 if (!HasSameAppsAsVerifier(i)) {
35 LOG(ERROR) << "Profile " << i << " doesn't have the same apps as the"
36 " verifier profile.";
37 return false;
38 }
39 }
40 return true;
41 }
42
43 void InstallApp(Profile* profile, int index) {
44 return SyncExtensionHelper::GetInstance()->InstallExtension(
45 profile, CreateFakeAppName(index), Extension::TYPE_HOSTED_APP);
46 }
47
48 void UninstallApp(Profile* profile, int index) {
49 return SyncExtensionHelper::GetInstance()->UninstallExtension(
50 profile, CreateFakeAppName(index));
51 }
52
53 void EnableApp(Profile* profile, int index) {
54 return SyncExtensionHelper::GetInstance()->EnableExtension(
55 profile, CreateFakeAppName(index));
56 }
57
58 void DisableApp(Profile* profile, int index) {
59 return SyncExtensionHelper::GetInstance()->DisableExtension(
60 profile, CreateFakeAppName(index));
61 }
62
63 void IncognitoEnableApp(Profile* profile, int index) {
64 return SyncExtensionHelper::GetInstance()->IncognitoEnableExtension(
65 profile, CreateFakeAppName(index));
66 }
67
68 void IncognitoDisableApp(Profile* profile, int index) {
69 return SyncExtensionHelper::GetInstance()->IncognitoDisableExtension(
70 profile, CreateFakeAppName(index));
71 }
72
73 void InstallAppsPendingForSync(Profile* profile) {
74 SyncExtensionHelper::GetInstance()->InstallExtensionsPendingForSync(
75 profile, Extension::TYPE_HOSTED_APP);
76 }
77
78 } // namespace apps_helper
OLDNEW
« no previous file with comments | « chrome/test/live_sync/apps_helper.h ('k') | chrome/test/live_sync/extensions_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698