| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" | 5 #include "chrome/browser/sync/test/integration/sync_extension_helper.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/extension_system.h" | 12 #include "chrome/browser/extensions/extension_system.h" |
| 13 #include "chrome/browser/extensions/pending_extension_info.h" | 13 #include "chrome/browser/extensions/pending_extension_info.h" |
| 14 #include "chrome/browser/extensions/pending_extension_manager.h" | 14 #include "chrome/browser/extensions/pending_extension_manager.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" |
| 17 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 16 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
| 17 #include "chrome/common/extensions/extension_manifest_constants.h" | 19 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 18 #include "chrome/common/string_ordinal.h" | 20 #include "sync/api/string_ordinal.h" |
| 19 #include "chrome/browser/sync/test/integration/sync_test.h" | |
| 20 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" | |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 22 |
| 23 using extensions::Extension; | 23 using extensions::Extension; |
| 24 | 24 |
| 25 SyncExtensionHelper::ExtensionState::ExtensionState() | 25 SyncExtensionHelper::ExtensionState::ExtensionState() |
| 26 : enabled_state(ENABLED), incognito_enabled(false) {} | 26 : enabled_state(ENABLED), incognito_enabled(false) {} |
| 27 | 27 |
| 28 SyncExtensionHelper::ExtensionState::~ExtensionState() {} | 28 SyncExtensionHelper::ExtensionState::~ExtensionState() {} |
| 29 | 29 |
| 30 bool SyncExtensionHelper::ExtensionState::Equals( | 30 bool SyncExtensionHelper::ExtensionState::Equals( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 64 } |
| 65 | 65 |
| 66 std::string SyncExtensionHelper::InstallExtension( | 66 std::string SyncExtensionHelper::InstallExtension( |
| 67 Profile* profile, const std::string& name, Extension::Type type) { | 67 Profile* profile, const std::string& name, Extension::Type type) { |
| 68 scoped_refptr<Extension> extension = GetExtension(profile, name, type); | 68 scoped_refptr<Extension> extension = GetExtension(profile, name, type); |
| 69 if (!extension.get()) { | 69 if (!extension.get()) { |
| 70 NOTREACHED() << "Could not install extension " << name; | 70 NOTREACHED() << "Could not install extension " << name; |
| 71 return ""; | 71 return ""; |
| 72 } | 72 } |
| 73 profile->GetExtensionService()->OnExtensionInstalled( | 73 profile->GetExtensionService()->OnExtensionInstalled( |
| 74 extension, extension->UpdatesFromGallery(), StringOrdinal()); | 74 extension, extension->UpdatesFromGallery(), syncer::StringOrdinal()); |
| 75 return extension->id(); | 75 return extension->id(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void SyncExtensionHelper::UninstallExtension( | 78 void SyncExtensionHelper::UninstallExtension( |
| 79 Profile* profile, const std::string& name) { | 79 Profile* profile, const std::string& name) { |
| 80 ExtensionService::UninstallExtensionHelper(profile->GetExtensionService(), | 80 ExtensionService::UninstallExtensionHelper(profile->GetExtensionService(), |
| 81 NameToId(name)); | 81 NameToId(name)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 std::vector<std::string> SyncExtensionHelper::GetInstalledExtensionNames( | 84 std::vector<std::string> SyncExtensionHelper::GetInstalledExtensionNames( |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 if (extension->id() != expected_id) { | 347 if (extension->id() != expected_id) { |
| 348 EXPECT_EQ(expected_id, extension->id()); | 348 EXPECT_EQ(expected_id, extension->id()); |
| 349 return NULL; | 349 return NULL; |
| 350 } | 350 } |
| 351 DVLOG(2) << "created extension with name = " | 351 DVLOG(2) << "created extension with name = " |
| 352 << name << ", id = " << expected_id; | 352 << name << ", id = " << expected_id; |
| 353 (it->second)[name] = extension; | 353 (it->second)[name] = extension; |
| 354 id_to_name_[expected_id] = name; | 354 id_to_name_[expected_id] = name; |
| 355 return extension; | 355 return extension; |
| 356 } | 356 } |
| OLD | NEW |