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

Unified Diff: chrome/test/live_sync/live_themes_sync_test.cc

Issue 4732005: [Sync] Added some basic extension sync integration tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed rsimha's comments Created 10 years, 1 month 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
Index: chrome/test/live_sync/live_themes_sync_test.cc
diff --git a/chrome/test/live_sync/live_themes_sync_test.cc b/chrome/test/live_sync/live_themes_sync_test.cc
index c9a5258d5be38a8ef4de25ddc083c4088e81c996..a92d8982691632bf8a169065165d42675ea1249c 100644
--- a/chrome/test/live_sync/live_themes_sync_test.cc
+++ b/chrome/test/live_sync/live_themes_sync_test.cc
@@ -6,86 +6,21 @@
#include <string>
-#include "base/file_path.h"
-#include "base/file_util.h"
#include "base/logging.h"
-#include "base/ref_counted.h"
-#include "base/string_number_conversions.h"
-#include "base/values.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/themes/browser_theme_provider.h"
#include "chrome/common/extensions/extension.h"
-#include "chrome/common/extensions/extension_constants.h"
LiveThemesSyncTest::LiveThemesSyncTest(TestType test_type)
- : LiveSyncTest(test_type) {}
+ : LiveExtensionsSyncTestBase(test_type) {}
LiveThemesSyncTest::~LiveThemesSyncTest() {}
-namespace {
-
-scoped_refptr<Extension> MakeTheme(const ScopedTempDir& scoped_temp_dir,
- int index) {
- DictionaryValue source;
- source.SetString(
- extension_manifest_keys::kName,
- std::string("ThemeExtension") + base::IntToString(index));
- source.SetString(extension_manifest_keys::kVersion, "0.0.0.0");
- source.Set(extension_manifest_keys::kTheme, new DictionaryValue());
- FilePath theme_dir;
- if (!file_util::CreateTemporaryDirInDir(scoped_temp_dir.path(),
- FILE_PATH_LITERAL("faketheme"),
- &theme_dir)) {
- return NULL;
- }
- std::string error;
- scoped_refptr<Extension> extension =
- Extension::Create(theme_dir,
- Extension::INTERNAL, source, false, &error);
- if (!error.empty()) {
- LOG(WARNING) << error;
- return NULL;
- }
- return extension;
-}
-
-} // namespace
-
-bool LiveThemesSyncTest::SetupClients() {
- if (!LiveSyncTest::SetupClients())
- return false;
-
- for (int i = 0; i < num_clients(); ++i) {
- GetProfile(i)->InitExtensions();
- }
- verifier()->InitExtensions();
-
- if (!theme_dir_.CreateUniqueTempDir())
- return false;
-
- for (int i = 0; i < num_clients(); ++i) {
- scoped_refptr<Extension> theme = MakeTheme(theme_dir_, i);
- if (!theme.get())
- return false;
- themes_.push_back(theme);
- }
-
- return true;
-}
-
-scoped_refptr<Extension> LiveThemesSyncTest::GetTheme(int index) {
- CHECK_GE(index, 0);
- CHECK_LT(index, static_cast<int>(themes_.size()));
- return themes_[index];
-}
-
void LiveThemesSyncTest::SetTheme(
Profile* profile, scoped_refptr<Extension> theme) {
- CHECK(profile);
- CHECK(theme.get());
CHECK(theme->is_theme());
- profile->GetExtensionsService()->OnExtensionInstalled(theme, true);
+ InstallExtension(profile, theme);
}
const Extension* LiveThemesSyncTest::GetCustomTheme(
« no previous file with comments | « chrome/test/live_sync/live_themes_sync_test.h ('k') | chrome/test/live_sync/single_client_live_extensions_sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698