OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/toolbar/toolbar_actions_model.h" | 5 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 dir1.WriteManifest(base::StringPrintf(kManifest, "incognito1")); | 1110 dir1.WriteManifest(base::StringPrintf(kManifest, "incognito1")); |
1111 extensions::TestExtensionDir dir2; | 1111 extensions::TestExtensionDir dir2; |
1112 dir2.WriteManifest(base::StringPrintf(kManifest, "incognito2")); | 1112 dir2.WriteManifest(base::StringPrintf(kManifest, "incognito2")); |
1113 | 1113 |
1114 extensions::TestExtensionDir* dirs[] = {&dir1, &dir2}; | 1114 extensions::TestExtensionDir* dirs[] = {&dir1, &dir2}; |
1115 const extensions::Extension* extensions[] = {nullptr, nullptr}; | 1115 const extensions::Extension* extensions[] = {nullptr, nullptr}; |
1116 for (size_t i = 0; i < arraysize(dirs); ++i) { | 1116 for (size_t i = 0; i < arraysize(dirs); ++i) { |
1117 // The extension id will be calculated from the file path; we need this to | 1117 // The extension id will be calculated from the file path; we need this to |
1118 // wait for the extension to load. | 1118 // wait for the extension to load. |
1119 base::FilePath path_for_id = | 1119 base::FilePath path_for_id = |
1120 base::MakeAbsoluteFilePath(dirs[i]->unpacked_path()); | 1120 base::MakeAbsoluteFilePath(dirs[i]->UnpackedPath()); |
1121 std::string id = crx_file::id_util::GenerateIdForPath(path_for_id); | 1121 std::string id = crx_file::id_util::GenerateIdForPath(path_for_id); |
1122 extensions::TestExtensionRegistryObserver observer(registry(), id); | 1122 extensions::TestExtensionRegistryObserver observer(registry(), id); |
1123 extensions::UnpackedInstaller::Create(service()) | 1123 extensions::UnpackedInstaller::Create(service())->Load( |
1124 ->Load(dirs[i]->unpacked_path()); | 1124 dirs[i]->UnpackedPath()); |
1125 observer.WaitForExtensionLoaded(); | 1125 observer.WaitForExtensionLoaded(); |
1126 extensions[i] = registry()->enabled_extensions().GetByID(id); | 1126 extensions[i] = registry()->enabled_extensions().GetByID(id); |
1127 ASSERT_TRUE(extensions[i]); | 1127 ASSERT_TRUE(extensions[i]); |
1128 } | 1128 } |
1129 | 1129 |
1130 // For readability, alias to A and B. Since we'll be reloading these | 1130 // For readability, alias to A and B. Since we'll be reloading these |
1131 // extensions, we also can't rely on pointers. | 1131 // extensions, we also can't rely on pointers. |
1132 std::string extension_a = extensions[0]->id(); | 1132 std::string extension_a = extensions[0]->id(); |
1133 std::string extension_b = extensions[1]->id(); | 1133 std::string extension_b = extensions[1]->id(); |
1134 | 1134 |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 } | 1533 } |
1534 | 1534 |
1535 TEST_F(ToolbarActionsModelUnitTest, | 1535 TEST_F(ToolbarActionsModelUnitTest, |
1536 MigrationToExtensionWithoutExtensionActionRedesign) { | 1536 MigrationToExtensionWithoutExtensionActionRedesign) { |
1537 InitForMigrationTest(MigrationStatus::FEATURE_DISABLED_WITH_PREF_TRUE); | 1537 InitForMigrationTest(MigrationStatus::FEATURE_DISABLED_WITH_PREF_TRUE); |
1538 | 1538 |
1539 // Initialization re-enables the extension. | 1539 // Initialization re-enables the extension. |
1540 EXPECT_EQ(1u, num_toolbar_items()); | 1540 EXPECT_EQ(1u, num_toolbar_items()); |
1541 EXPECT_EQ(browser_action_migrated()->id(), GetActionIdAtIndex(0u)); | 1541 EXPECT_EQ(browser_action_migrated()->id(), GetActionIdAtIndex(0u)); |
1542 } | 1542 } |
OLD | NEW |