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

Unified Diff: chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc

Issue 764643002: Remove WebViewKey in rules registry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renaming move "remove rules registry for webview" part to WebViewGuest. Created 6 years, 1 month 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/rules_registry_with_cache_unittest.cc
diff --git a/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc b/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc
index 53744d7660644578e14abbceecb806dd85a6b70a..37a3658100c72bf4cc03e6954076c2e300ca9d48 100644
--- a/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc
+++ b/chrome/browser/extensions/api/declarative/rules_registry_with_cache_unittest.cc
@@ -32,6 +32,7 @@ using extension_test_util::LoadManifestUnchecked;
namespace {
const char kRuleId[] = "rule";
const char kRule2Id[] = "rule2";
+const int kRulesRegistryID = 0;
}
namespace extensions {
@@ -44,7 +45,7 @@ class RulesRegistryWithCacheTest : public testing::Test {
/*event_name=*/"",
content::BrowserThread::UI,
&cache_delegate_,
- RulesRegistry::WebViewKey(0, 0))) {}
+ kRulesRegistryID)) {}
void SetUp() override {
env_.GetExtensionPrefs(); // Force creation before adding extensions.
@@ -233,10 +234,9 @@ TEST_F(RulesRegistryWithCacheTest, DeclarativeRulesStored) {
RulesCacheDelegate::GetRulesStoredKey(
event_name, profile()->IsOffTheRecord()));
scoped_ptr<RulesCacheDelegate> cache_delegate(new RulesCacheDelegate(false));
- scoped_refptr<RulesRegistry> registry(new TestRulesRegistry(
- profile(), event_name, content::BrowserThread::UI,
- cache_delegate.get(),
- RulesRegistry::WebViewKey(0, 0)));
+ scoped_refptr<RulesRegistry> registry(
+ new TestRulesRegistry(profile(), event_name, content::BrowserThread::UI,
+ cache_delegate.get(), kRulesRegistryID));
// 1. Test the handling of preferences.
// Default value is always true.
@@ -303,16 +303,14 @@ TEST_F(RulesRegistryWithCacheTest, RulesStoredFlagMultipleRegistries) {
RulesCacheDelegate::GetRulesStoredKey(
event_name2, profile()->IsOffTheRecord()));
scoped_ptr<RulesCacheDelegate> cache_delegate1(new RulesCacheDelegate(false));
- scoped_refptr<RulesRegistry> registry1(new TestRulesRegistry(
- profile(), event_name1, content::BrowserThread::UI,
- cache_delegate1.get(),
- RulesRegistry::WebViewKey(0, 0)));
+ scoped_refptr<RulesRegistry> registry1(
+ new TestRulesRegistry(profile(), event_name1, content::BrowserThread::UI,
+ cache_delegate1.get(), kRulesRegistryID));
scoped_ptr<RulesCacheDelegate> cache_delegate2(new RulesCacheDelegate(false));
- scoped_refptr<RulesRegistry> registry2(new TestRulesRegistry(
- profile(), event_name2, content::BrowserThread::UI,
- cache_delegate2.get(),
- RulesRegistry::WebViewKey(0, 0)));
+ scoped_refptr<RulesRegistry> registry2(
+ new TestRulesRegistry(profile(), event_name2, content::BrowserThread::UI,
+ cache_delegate2.get(), kRulesRegistryID));
// Checkt the correct default values.
EXPECT_TRUE(cache_delegate1->GetDeclarativeRulesStored(extension1_->id()));
@@ -355,12 +353,9 @@ TEST_F(RulesRegistryWithCacheTest, RulesPreservedAcrossRestart) {
// 2. First run, adding a rule for the extension.
scoped_ptr<RulesCacheDelegate> cache_delegate(new RulesCacheDelegate(false));
- scoped_refptr<TestRulesRegistry> registry(new TestRulesRegistry(
- profile(),
- "testEvent",
- content::BrowserThread::UI,
- cache_delegate.get(),
- RulesRegistry::WebViewKey(0, 0)));
+ scoped_refptr<TestRulesRegistry> registry(
+ new TestRulesRegistry(profile(), "testEvent", content::BrowserThread::UI,
+ cache_delegate.get(), kRulesRegistryID));
AddRule(extension1_->id(), kRuleId, registry.get());
base::RunLoop().RunUntilIdle(); // Posted tasks store the added rule.
@@ -368,12 +363,9 @@ TEST_F(RulesRegistryWithCacheTest, RulesPreservedAcrossRestart) {
// 3. Restart the TestRulesRegistry and see the rule still there.
cache_delegate.reset(new RulesCacheDelegate(false));
- registry = new TestRulesRegistry(
- profile(),
- "testEvent",
- content::BrowserThread::UI,
- cache_delegate.get(),
- RulesRegistry::WebViewKey(0, 0));
+ registry =
+ new TestRulesRegistry(profile(), "testEvent", content::BrowserThread::UI,
+ cache_delegate.get(), kRulesRegistryID);
base::RunLoop().RunUntilIdle(); // Posted tasks retrieve the stored rule.
EXPECT_EQ(1, GetNumberOfRules(extension1_->id(), registry.get()));

Powered by Google App Engine
This is Rietveld 408576698