| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 size_t NumberOfRegisteredRules(const std::string& extension_id) { | 111 size_t NumberOfRegisteredRules(const std::string& extension_id) { |
| 112 RulesRegistryService* rules_registry_service = | 112 RulesRegistryService* rules_registry_service = |
| 113 extensions::RulesRegistryService::Get(browser()->profile()); | 113 extensions::RulesRegistryService::Get(browser()->profile()); |
| 114 scoped_refptr<RulesRegistry> rules_registry = | 114 scoped_refptr<RulesRegistry> rules_registry = |
| 115 rules_registry_service->GetRulesRegistry( | 115 rules_registry_service->GetRulesRegistry( |
| 116 RulesRegistryService::kDefaultRulesRegistryID, | 116 RulesRegistryService::kDefaultRulesRegistryID, |
| 117 extensions::declarative_webrequest_constants::kOnRequest); | 117 extensions::declarative_webrequest_constants::kOnRequest); |
| 118 | 118 |
| 119 std::vector<linked_ptr<api::events::Rule>> rules; | 119 std::vector<linked_ptr<api::events::Rule>> rules; |
| 120 BrowserThread::PostTask( | 120 BrowserThread::PostTask( |
| 121 BrowserThread::IO, | 121 BrowserThread::IO, FROM_HERE, |
| 122 FROM_HERE, | 122 base::BindOnce(&RulesRegistry::GetAllRules, rules_registry, |
| 123 base::Bind( | 123 extension_id, &rules)); |
| 124 &RulesRegistry::GetAllRules, rules_registry, extension_id, &rules)); | |
| 125 scoped_refptr<base::ThreadTestHelper> io_helper(new base::ThreadTestHelper( | 124 scoped_refptr<base::ThreadTestHelper> io_helper(new base::ThreadTestHelper( |
| 126 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO).get())); | 125 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO).get())); |
| 127 EXPECT_TRUE(io_helper->Run()); | 126 EXPECT_TRUE(io_helper->Run()); |
| 128 return rules.size(); | 127 return rules.size(); |
| 129 } | 128 } |
| 130 }; | 129 }; |
| 131 | 130 |
| 132 IN_PROC_BROWSER_TEST_F(DeclarativeApiTest, DeclarativeApi) { | 131 IN_PROC_BROWSER_TEST_F(DeclarativeApiTest, DeclarativeApi) { |
| 133 ASSERT_TRUE(RunExtensionTest("declarative/api")) << message_; | 132 ASSERT_TRUE(RunExtensionTest("declarative/api")) << message_; |
| 134 | 133 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 248 |
| 250 // 2. Uninstall the extension. Rules are gone and preferences should be empty. | 249 // 2. Uninstall the extension. Rules are gone and preferences should be empty. |
| 251 UninstallExtension(extension_id); | 250 UninstallExtension(extension_id); |
| 252 ui_test_utils::NavigateToURL(browser(), GURL(kArbitraryUrl)); | 251 ui_test_utils::NavigateToURL(browser(), GURL(kArbitraryUrl)); |
| 253 EXPECT_NE(kTestTitle, GetTitle()); | 252 EXPECT_NE(kTestTitle, GetTitle()); |
| 254 EXPECT_EQ(0u, NumberOfRegisteredRules(extension_id)); | 253 EXPECT_EQ(0u, NumberOfRegisteredRules(extension_id)); |
| 255 EXPECT_FALSE(extension_prefs->HasPrefForExtension(extension_id)); | 254 EXPECT_FALSE(extension_prefs->HasPrefForExtension(extension_id)); |
| 256 } | 255 } |
| 257 | 256 |
| 258 } // namespace extensions | 257 } // namespace extensions |
| OLD | NEW |