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

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

Issue 20593003: Move kEnableExperimentalExtensionApis switch to extensions/common/switches.cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 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 | Annotate | Revision Log
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" 9 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h"
10 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h" 10 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h"
11 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_ registry.h" 11 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_ registry.h"
12 #include "chrome/browser/extensions/extension_apitest.h" 12 #include "chrome/browser/extensions/extension_apitest.h"
13 #include "chrome/browser/extensions/extension_system_factory.h" 13 #include "chrome/browser/extensions/extension_system_factory.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/extensions/extension.h" 16 #include "chrome/common/extensions/extension.h"
18 #include "chrome/test/base/ui_test_utils.h" 17 #include "chrome/test/base/ui_test_utils.h"
19 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
20 19
21 using extensions::RulesRegistry; 20 using extensions::RulesRegistry;
22 using extensions::RulesRegistryService; 21 using extensions::RulesRegistryService;
23 using extensions::WebRequestRulesRegistry; 22 using extensions::WebRequestRulesRegistry;
24 23
25 class DeclarativeApiTest : public ExtensionApiTest { 24 class DeclarativeApiTest : public ExtensionApiTest {
26 public:
27 DeclarativeApiTest() {}
28 virtual ~DeclarativeApiTest() {}
29
30 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
31 ExtensionApiTest::SetUpCommandLine(command_line);
32 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
33 }
34 }; 25 };
35 26
36 IN_PROC_BROWSER_TEST_F(DeclarativeApiTest, DeclarativeApi) { 27 IN_PROC_BROWSER_TEST_F(DeclarativeApiTest, DeclarativeApi) {
37 ASSERT_TRUE(RunExtensionTest("declarative/api")) << message_; 28 ASSERT_TRUE(RunExtensionTest("declarative/api")) << message_;
38 29
39 // Check that unloading the page has removed all rules. 30 // Check that unloading the page has removed all rules.
40 std::string extension_id = GetSingleLoadedExtension()->id(); 31 std::string extension_id = GetSingleLoadedExtension()->id();
41 UnloadExtension(extension_id); 32 UnloadExtension(extension_id);
42 33
43 // UnloadExtension posts a task to the owner thread of the extension 34 // UnloadExtension posts a task to the owner thread of the extension
(...skipping 11 matching lines...) Expand all
55 content::BrowserThread::PostTask( 46 content::BrowserThread::PostTask(
56 rules_registry->owner_thread(), 47 rules_registry->owner_thread(),
57 FROM_HERE, 48 FROM_HERE,
58 base::Bind(base::IgnoreResult(&RulesRegistry::GetAllRules), 49 base::Bind(base::IgnoreResult(&RulesRegistry::GetAllRules),
59 rules_registry, extension_id, &known_rules)); 50 rules_registry, extension_id, &known_rules));
60 51
61 content::RunAllPendingInMessageLoop(rules_registry->owner_thread()); 52 content::RunAllPendingInMessageLoop(rules_registry->owner_thread());
62 53
63 EXPECT_TRUE(known_rules.empty()); 54 EXPECT_TRUE(known_rules.empty());
64 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698