Chromium Code Reviews| 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 "chrome/browser/extensions/api/declarative_content/content_rules_regist ry.h" | 5 #include "chrome/browser/extensions/api/declarative_content/content_rules_regist ry.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/test/values_test_util.h" | 9 #include "base/test/values_test_util.h" |
| 10 #include "chrome/browser/extensions/extension_tab_util.h" | 10 #include "chrome/browser/extensions/extension_tab_util.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 const ContentRulesRegistry& registry) { | 30 const ContentRulesRegistry& registry) { |
| 31 return registry.active_rules_; | 31 return registry.active_rules_; |
| 32 } | 32 } |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 TEST_F(DeclarativeContentRulesRegistryTest, ActiveRulesDoesntGrow) { | 37 TEST_F(DeclarativeContentRulesRegistryTest, ActiveRulesDoesntGrow) { |
| 38 TestExtensionEnvironment env; | 38 TestExtensionEnvironment env; |
| 39 | 39 |
| 40 const RulesRegistry::WebViewKey key(0, 0); | |
|
Jeffrey Yasskin
2013/11/09 02:47:22
If this is never used, don't add it.
Fady Samuel
2013/11/10 03:39:56
Done.
| |
| 40 scoped_refptr<ContentRulesRegistry> registry( | 41 scoped_refptr<ContentRulesRegistry> registry( |
| 41 new ContentRulesRegistry(env.profile(), NULL)); | 42 new ContentRulesRegistry(env.profile(), NULL)); |
| 42 | 43 |
| 43 EXPECT_EQ(0u, active_rules(*registry.get()).size()); | 44 EXPECT_EQ(0u, active_rules(*registry.get()).size()); |
| 44 | 45 |
| 45 content::LoadCommittedDetails load_details; | 46 content::LoadCommittedDetails load_details; |
| 46 content::FrameNavigateParams navigate_params; | 47 content::FrameNavigateParams navigate_params; |
| 47 scoped_ptr<WebContents> tab = env.MakeTab(); | 48 scoped_ptr<WebContents> tab = env.MakeTab(); |
| 48 registry->DidNavigateMainFrame(tab.get(), load_details, navigate_params); | 49 registry->DidNavigateMainFrame(tab.get(), load_details, navigate_params); |
| 49 EXPECT_EQ(0u, active_rules(*registry.get()).size()); | 50 EXPECT_EQ(0u, active_rules(*registry.get()).size()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 registry->Apply(tab.get(), css_selectors); | 89 registry->Apply(tab.get(), css_selectors); |
| 89 EXPECT_EQ(1u, active_rules(*registry.get()).size()); | 90 EXPECT_EQ(1u, active_rules(*registry.get()).size()); |
| 90 // Navigating the tab should erase its entry from active_rules_ if | 91 // Navigating the tab should erase its entry from active_rules_ if |
| 91 // it no longer matches. | 92 // it no longer matches. |
| 92 registry->DidNavigateMainFrame(tab.get(), load_details, navigate_params); | 93 registry->DidNavigateMainFrame(tab.get(), load_details, navigate_params); |
| 93 EXPECT_EQ(0u, active_rules(*registry.get()).size()); | 94 EXPECT_EQ(0u, active_rules(*registry.get()).size()); |
| 94 } | 95 } |
| 95 | 96 |
| 96 } // namespace | 97 } // namespace |
| 97 } // namespace extensions | 98 } // namespace extensions |
| OLD | NEW |