OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 registry()->enabled_extensions().Contains(migrated_extension_a_->id())); | 184 registry()->enabled_extensions().Contains(migrated_extension_a_->id())); |
185 } | 185 } |
186 | 186 |
187 TEST_F(ComponentMigrationHelperTest, InstallUnregisteredExtension) { | 187 TEST_F(ComponentMigrationHelperTest, InstallUnregisteredExtension) { |
188 service()->AddExtension(unregistered_extension_.get()); | 188 service()->AddExtension(unregistered_extension_.get()); |
189 EXPECT_FALSE(IsTestComponentActionEnabled()); | 189 EXPECT_FALSE(IsTestComponentActionEnabled()); |
190 EXPECT_TRUE( | 190 EXPECT_TRUE( |
191 registry()->enabled_extensions().Contains(unregistered_extension_->id())); | 191 registry()->enabled_extensions().Contains(unregistered_extension_->id())); |
192 } | 192 } |
193 | 193 |
| 194 TEST_F(ComponentMigrationHelperTest, RemoveComponentAction) { |
| 195 mock_helper_->SetTestComponentActionPref(true); |
| 196 |
| 197 EXPECT_CALL(mock_delegate_, HasComponentAction(kTestActionId)) |
| 198 .WillOnce(Return(false)); |
| 199 EXPECT_CALL(mock_delegate_, AddComponentAction(kTestActionId)); |
| 200 |
| 201 mock_helper_->OnFeatureEnabled(kTestActionId); |
| 202 EXPECT_TRUE(IsTestComponentActionEnabled()); |
| 203 |
| 204 EXPECT_CALL(mock_delegate_, HasComponentAction(kTestActionId)) |
| 205 .WillOnce(Return(true)); |
| 206 EXPECT_CALL(mock_delegate_, RemoveComponentAction(kTestActionId)); |
| 207 |
| 208 mock_helper_->OnActionRemoved(kTestActionId); |
| 209 EXPECT_FALSE(IsTestComponentActionEnabled()); |
| 210 } |
| 211 |
194 } // namespace extensions | 212 } // namespace extensions |
OLD | NEW |