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( |