| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/extension_migrator.h" | 5 #include "chrome/browser/extensions/extension_migrator.h" |
| 6 | 6 |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/extension_service_test_base.h" | 11 #include "chrome/browser/extensions/extension_service_test_base.h" |
| 12 #include "chrome/browser/extensions/external_provider_impl.h" | 12 #include "chrome/browser/extensions/external_provider_impl.h" |
| 13 #include "chrome/browser/extensions/pending_extension_manager.h" | 13 #include "chrome/browser/extensions/pending_extension_manager.h" |
| 14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
| 15 #include "extensions/browser/extension_registry.h" | 15 #include "extensions/browser/extension_registry.h" |
| 16 #include "extensions/common/extension_builder.h" | 16 #include "extensions/common/extension_builder.h" |
| 17 | 17 |
| 18 namespace extensions { | 18 namespace extensions { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 const char kOldId[] = "oooooooooooooooooooooooooooooooo"; | 22 const char kOldId[] = "oooooooooooooooooooooooooooooooo"; |
| 23 const char kNewId[] = "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"; | 23 const char kNewId[] = "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"; |
| 24 | 24 |
| 25 scoped_refptr<Extension> CreateExtension(const std::string& id) { | 25 scoped_refptr<Extension> CreateExtension(const std::string& id) { |
| 26 return ExtensionBuilder() | 26 return ExtensionBuilder() |
| 27 .SetManifest(std::move( | 27 .SetManifest( |
| 28 DictionaryBuilder().Set("name", "test").Set("version", "0.1"))) | 28 DictionaryBuilder().Set("name", "test").Set("version", "0.1").Build()) |
| 29 .SetID(id) | 29 .SetID(id) |
| 30 .Build(); | 30 .Build(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 class ExtensionMigratorTest : public ExtensionServiceTestBase { | 35 class ExtensionMigratorTest : public ExtensionServiceTestBase { |
| 36 public: | 36 public: |
| 37 ExtensionMigratorTest() {} | 37 ExtensionMigratorTest() {} |
| 38 ~ExtensionMigratorTest() override {} | 38 ~ExtensionMigratorTest() override {} |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 InitWithExistingProfile(); | 102 InitWithExistingProfile(); |
| 103 AddExtension(kOldId); | 103 AddExtension(kOldId); |
| 104 AddExtension(kNewId); | 104 AddExtension(kNewId); |
| 105 service()->CheckForExternalUpdates(); | 105 service()->CheckForExternalUpdates(); |
| 106 base::RunLoop().RunUntilIdle(); | 106 base::RunLoop().RunUntilIdle(); |
| 107 EXPECT_TRUE(!!registry()->GetInstalledExtension(kOldId)); | 107 EXPECT_TRUE(!!registry()->GetInstalledExtension(kOldId)); |
| 108 EXPECT_TRUE(!!registry()->GetInstalledExtension(kNewId)); | 108 EXPECT_TRUE(!!registry()->GetInstalledExtension(kNewId)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace extensions | 111 } // namespace extensions |
| OLD | NEW |