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

Side by Side Diff: chrome/browser/extensions/api/declarative/rules_registry_service_unittest.cc

Issue 1226353004: Generate all extension schema namespaces as "api" and instead vary the generated bundle names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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 unified diff | Download patch
OLDNEW
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 "extensions/browser/api/declarative/rules_registry_service.h" 5 #include "extensions/browser/api/declarative/rules_registry_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "chrome/test/base/testing_profile.h" 9 #include "chrome/test/base/testing_profile.h"
10 #include "content/public/test/test_browser_thread.h" 10 #include "content/public/test/test_browser_thread.h"
11 #include "extensions/browser/api/declarative/test_rules_registry.h" 11 #include "extensions/browser/api/declarative/test_rules_registry.h"
12 #include "extensions/browser/api/declarative_webrequest/webrequest_constants.h" 12 #include "extensions/browser/api/declarative_webrequest/webrequest_constants.h"
13 #include "extensions/common/extension.h" 13 #include "extensions/common/extension.h"
14 #include "extensions/common/extension_builder.h" 14 #include "extensions/common/extension_builder.h"
15 #include "extensions/common/value_builder.h" 15 #include "extensions/common/value_builder.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 namespace { 18 namespace {
19 const char kExtensionId[] = "foo"; 19 const char kExtensionId[] = "foo";
20 20
21 void InsertRule(scoped_refptr<extensions::RulesRegistry> registry, 21 void InsertRule(scoped_refptr<extensions::RulesRegistry> registry,
22 const std::string& id) { 22 const std::string& id) {
23 std::vector<linked_ptr<extensions::core_api::events::Rule> > add_rules; 23 std::vector<linked_ptr<extensions::api::events::Rule>> add_rules;
24 add_rules.push_back(make_linked_ptr(new extensions::core_api::events::Rule)); 24 add_rules.push_back(make_linked_ptr(new extensions::api::events::Rule));
25 add_rules[0]->id.reset(new std::string(id)); 25 add_rules[0]->id.reset(new std::string(id));
26 std::string error = registry->AddRules(kExtensionId, add_rules); 26 std::string error = registry->AddRules(kExtensionId, add_rules);
27 EXPECT_TRUE(error.empty()); 27 EXPECT_TRUE(error.empty());
28 } 28 }
29 29
30 void VerifyNumberOfRules(scoped_refptr<extensions::RulesRegistry> registry, 30 void VerifyNumberOfRules(scoped_refptr<extensions::RulesRegistry> registry,
31 size_t expected_number_of_rules) { 31 size_t expected_number_of_rules) {
32 std::vector<linked_ptr<extensions::core_api::events::Rule> > get_rules; 32 std::vector<linked_ptr<extensions::api::events::Rule>> get_rules;
33 registry->GetAllRules(kExtensionId, &get_rules); 33 registry->GetAllRules(kExtensionId, &get_rules);
34 EXPECT_EQ(expected_number_of_rules, get_rules.size()); 34 EXPECT_EQ(expected_number_of_rules, get_rules.size());
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 38
39 namespace extensions { 39 namespace extensions {
40 40
41 class RulesRegistryServiceTest : public testing::Test { 41 class RulesRegistryServiceTest : public testing::Test {
42 public: 42 public:
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 content::BrowserThread::PostTask( 118 content::BrowserThread::PostTask(
119 content::BrowserThread::IO, FROM_HERE, 119 content::BrowserThread::IO, FROM_HERE,
120 base::Bind(&VerifyNumberOfRules, 120 base::Bind(&VerifyNumberOfRules,
121 registry_service.GetRulesRegistry(key, "io"), 0)); 121 registry_service.GetRulesRegistry(key, "io"), 0));
122 122
123 message_loop_.RunUntilIdle(); 123 message_loop_.RunUntilIdle();
124 } 124 }
125 125
126 } // namespace extensions 126 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698