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

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

Issue 9422003: Migrate Declarative API bindings to new JSON objects generated by JSON compiler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory leaks Created 8 years, 10 months 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/declarative_apitest.cc
diff --git a/chrome/browser/extensions/api/declarative/declarative_apitest.cc b/chrome/browser/extensions/api/declarative/declarative_apitest.cc
index eb6a248edf87031a372565017dd12164968f5feb..cb6ad1418282ca4230e0da6a4cee9b3d78a28e5a 100644
--- a/chrome/browser/extensions/api/declarative/declarative_apitest.cc
+++ b/chrome/browser/extensions/api/declarative/declarative_apitest.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
+#include "chrome/test/base/ui_test_utils.h"
using namespace extensions;
@@ -31,18 +32,16 @@ class DeclarativeApiTest : public ExtensionApiTest {
void RegisterTestRuleRegistry() {
Profile* profile = browser()->profile();
- RulesRegistryService* rules_registry =
+ RulesRegistryService* rules_registry_service =
profile->GetExtensionService()->GetRulesRegistryService();
- scoped_ptr<RulesRegistry> test_rules_registry(new TestRulesRegistry());
- test_rules_registry_ = test_rules_registry.get();
+ test_rules_registry_ = new TestRulesRegistry();
// TODO(battre): Remove this, once we have a real implementation for a
// RulesRegistry.
- rules_registry->RegisterRulesRegistry(kTestEvent,
- test_rules_registry.Pass());
+ rules_registry_service->RegisterRulesRegistry(kTestEvent,
+ test_rules_registry_);
}
- // Weak pointer that is deleted when the profile is destroyed.
- RulesRegistry* test_rules_registry_;
+ scoped_refptr<RulesRegistry> test_rules_registry_;
};
IN_PROC_BROWSER_TEST_F(DeclarativeApiTest, DeclarativeApi) {
@@ -53,10 +52,13 @@ IN_PROC_BROWSER_TEST_F(DeclarativeApiTest, DeclarativeApi) {
std::string extension_id = GetSingleLoadedExtension()->id();
UnloadExtension(extension_id);
- std::vector<std::string> rule_identifiers; // Empty to get all rules.
- std::vector<DictionaryValue*> known_rules;
- test_rules_registry_->GetRules(extension_id,
- rule_identifiers,
- &known_rules);
+ // Make sure that RulesRegistry had a chance to process unloading the
+ // extension.
+ ui_test_utils::RunAllPendingInMessageLoop(
+ test_rules_registry_->GetOwnerThread());
+
+ std::vector<linked_ptr<RulesRegistry::Rule> > known_rules;
+
+ test_rules_registry_->GetAllRules(extension_id, &known_rules);
EXPECT_TRUE(known_rules.empty());
}

Powered by Google App Engine
This is Rietveld 408576698