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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/live_sync/apps_helper.cc
diff --git a/chrome/test/live_sync/apps_helper.cc b/chrome/test/live_sync/apps_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..be8d6425113ef2c85c7744f6a5249cf192727021
--- /dev/null
+++ b/chrome/test/live_sync/apps_helper.cc
@@ -0,0 +1,78 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/test/live_sync/apps_helper.h"
+
+#include "base/logging.h"
+#include "base/string_number_conversions.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/extensions/extension.h"
+#include "chrome/test/live_sync/sync_datatype_helper.h"
+#include "chrome/test/live_sync/sync_extension_helper.h"
+
+using sync_datatype_helper::test;
+
+namespace {
+
+std::string CreateFakeAppName(int index) {
+ return "fakeapp" + base::IntToString(index);
+}
+
+} // namespace
+
+namespace apps_helper {
+
+bool HasSameAppsAsVerifier(int index) {
+ // TODO(akalin): We may want to filter out non-apps for some tests.
+ return SyncExtensionHelper::GetInstance()->ExtensionStatesMatch(
+ test()->GetProfile(index), test()->verifier());
+}
+
+bool AllProfilesHaveSameAppsAsVerifier() {
+ for (int i = 0; i < test()->num_clients(); ++i) {
+ if (!HasSameAppsAsVerifier(i)) {
+ LOG(ERROR) << "Profile " << i << " doesn't have the same apps as the"
+ " verifier profile.";
+ return false;
+ }
+ }
+ return true;
+}
+
+void InstallApp(Profile* profile, int index) {
+ return SyncExtensionHelper::GetInstance()->InstallExtension(
+ profile, CreateFakeAppName(index), Extension::TYPE_HOSTED_APP);
+}
+
+void UninstallApp(Profile* profile, int index) {
+ return SyncExtensionHelper::GetInstance()->UninstallExtension(
+ profile, CreateFakeAppName(index));
+}
+
+void EnableApp(Profile* profile, int index) {
+ return SyncExtensionHelper::GetInstance()->EnableExtension(
+ profile, CreateFakeAppName(index));
+}
+
+void DisableApp(Profile* profile, int index) {
+ return SyncExtensionHelper::GetInstance()->DisableExtension(
+ profile, CreateFakeAppName(index));
+}
+
+void IncognitoEnableApp(Profile* profile, int index) {
+ return SyncExtensionHelper::GetInstance()->IncognitoEnableExtension(
+ profile, CreateFakeAppName(index));
+}
+
+void IncognitoDisableApp(Profile* profile, int index) {
+ return SyncExtensionHelper::GetInstance()->IncognitoDisableExtension(
+ profile, CreateFakeAppName(index));
+}
+
+void InstallAppsPendingForSync(Profile* profile) {
+ SyncExtensionHelper::GetInstance()->InstallExtensionsPendingForSync(
+ profile, Extension::TYPE_HOSTED_APP);
+}
+
+} // namespace apps_helper
« 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