| 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 "extensions/browser/api/declarative/rules_registry.h" | 5 #include "extensions/browser/api/declarative/rules_registry.h" |
| 6 | 6 |
| 7 // Here we test the TestRulesRegistry which is the simplest possible | 7 // Here we test the TestRulesRegistry which is the simplest possible |
| 8 // implementation of RulesRegistryWithCache as a proxy for | 8 // implementation of RulesRegistryWithCache as a proxy for |
| 9 // RulesRegistryWithCache. | 9 // RulesRegistryWithCache. |
| 10 | 10 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 (kRuleId == *(gotten_rules[1]->id) && | 211 (kRuleId == *(gotten_rules[1]->id) && |
| 212 kRule2Id == *(gotten_rules[0]->id)) ); | 212 kRule2Id == *(gotten_rules[0]->id)) ); |
| 213 } | 213 } |
| 214 | 214 |
| 215 TEST_F(RulesRegistryWithCacheTest, OnExtensionUninstalled) { | 215 TEST_F(RulesRegistryWithCacheTest, OnExtensionUninstalled) { |
| 216 // Prime registry. | 216 // Prime registry. |
| 217 EXPECT_EQ("", AddRule(extension1_->id(), kRuleId)); | 217 EXPECT_EQ("", AddRule(extension1_->id(), kRuleId)); |
| 218 EXPECT_EQ("", AddRule(extension2_->id(), kRuleId)); | 218 EXPECT_EQ("", AddRule(extension2_->id(), kRuleId)); |
| 219 | 219 |
| 220 // Check that the correct rules are removed. | 220 // Check that the correct rules are removed. |
| 221 registry_->OnExtensionUninstalled(extension1_->id()); | 221 registry_->OnExtensionUninstalled(extension1_.get()); |
| 222 EXPECT_EQ(0, GetNumberOfRules(extension1_->id())); | 222 EXPECT_EQ(0, GetNumberOfRules(extension1_->id())); |
| 223 EXPECT_EQ(1, GetNumberOfRules(extension2_->id())); | 223 EXPECT_EQ(1, GetNumberOfRules(extension2_->id())); |
| 224 } | 224 } |
| 225 | 225 |
| 226 TEST_F(RulesRegistryWithCacheTest, DeclarativeRulesStored) { | 226 TEST_F(RulesRegistryWithCacheTest, DeclarativeRulesStored) { |
| 227 ExtensionPrefs* extension_prefs = env_.GetExtensionPrefs(); | 227 ExtensionPrefs* extension_prefs = env_.GetExtensionPrefs(); |
| 228 // The value store is first created during GetExtensionService. | 228 // The value store is first created during GetExtensionService. |
| 229 TestingValueStore* store = env_.GetExtensionSystem()->value_store(); | 229 TestingValueStore* store = env_.GetExtensionSystem()->value_store(); |
| 230 | 230 |
| 231 const std::string event_name("testEvent"); | 231 const std::string event_name("testEvent"); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 | 381 |
| 382 int write_count = store->write_count(); | 382 int write_count = store->write_count(); |
| 383 EXPECT_EQ("", AddRule(extension1_->id(), kRuleId)); | 383 EXPECT_EQ("", AddRule(extension1_->id(), kRuleId)); |
| 384 EXPECT_EQ("", AddRule(extension2_->id(), kRule2Id)); | 384 EXPECT_EQ("", AddRule(extension2_->id(), kRule2Id)); |
| 385 env_.GetExtensionSystem()->SetReady(); | 385 env_.GetExtensionSystem()->SetReady(); |
| 386 base::RunLoop().RunUntilIdle(); | 386 base::RunLoop().RunUntilIdle(); |
| 387 EXPECT_EQ(write_count + 2, store->write_count()); | 387 EXPECT_EQ(write_count + 2, store->write_count()); |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace extensions | 390 } // namespace extensions |
| OLD | NEW |