Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1211)

Unified Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc

Issue 11569007: Refactoring how conditions without URL attributes are handled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Polished 1st version Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
index 3d6895c559d3856079aab304eb38a3142c7e4d0d..b1ec324d42d426afe1024e00ddc6347d7ff8d7e8 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
@@ -42,6 +42,12 @@ class TestWebRequestRulesRegistry : public WebRequestRulesRegistry {
// to be cleared.
int num_clear_cache_calls() const { return num_clear_cache_calls_; }
+ // How many rules are there which have some conditions not triggered by URL
+ // matches.
+ size_t RulesWithoutTriggers() const {
+ return rules_with_untriggered_conditions_for_test().size();
+ }
+
protected:
virtual ~TestWebRequestRulesRegistry() {}
@@ -263,6 +269,7 @@ TEST_F(WebRequestRulesRegistryTest, RemoveRulesImpl) {
std::vector<linked_ptr<RulesRegistry::Rule> > registered_rules;
registry->GetAllRules(kExtensionId, &registered_rules);
EXPECT_EQ(2u, registered_rules.size());
+ EXPECT_EQ(1u, registry->RulesWithoutTriggers());
// Remove first rule.
std::vector<std::string> rules_to_remove;
@@ -275,6 +282,7 @@ TEST_F(WebRequestRulesRegistryTest, RemoveRulesImpl) {
registered_rules.clear();
registry->GetAllRules(kExtensionId, &registered_rules);
EXPECT_EQ(1u, registered_rules.size());
+ EXPECT_EQ(1u, registry->RulesWithoutTriggers());
// Now rules_to_remove contains both rules, i.e. one that does not exist in
// the rules registry anymore. Effectively we only remove the second rule.
@@ -287,6 +295,7 @@ TEST_F(WebRequestRulesRegistryTest, RemoveRulesImpl) {
registered_rules.clear();
registry->GetAllRules(kExtensionId, &registered_rules);
EXPECT_EQ(0u, registered_rules.size());
+ EXPECT_EQ(0u, registry->RulesWithoutTriggers());
EXPECT_TRUE(registry->IsEmpty());
}

Powered by Google App Engine
This is Rietveld 408576698