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

Side by Side Diff: chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc

Issue 107063002: Disable cloud policy for extensions by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <string> 5 #include <string>
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/policy/policy_service.h" 21 #include "chrome/browser/policy/policy_service.h"
22 #include "chrome/browser/policy/profile_policy_connector.h" 22 #include "chrome/browser/policy/profile_policy_connector.h"
23 #include "chrome/browser/policy/profile_policy_connector_factory.h" 23 #include "chrome/browser/policy/profile_policy_connector_factory.h"
24 #include "chrome/browser/policy/proto/cloud/chrome_extension_policy.pb.h" 24 #include "chrome/browser/policy/proto/cloud/chrome_extension_policy.pb.h"
25 #include "chrome/browser/policy/test/local_policy_test_server.h" 25 #include "chrome/browser/policy/test/local_policy_test_server.h"
26 #include "chrome/browser/policy/test/policy_test_utils.h" 26 #include "chrome/browser/policy/test/policy_test_utils.h"
27 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/ui/browser.h" 28 #include "chrome/browser/ui/browser.h"
29 #include "chrome/common/chrome_paths.h" 29 #include "chrome/common/chrome_paths.h"
30 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
31 #include "components/policy/core/common/policy_switches.h"
31 #include "extensions/common/extension.h" 32 #include "extensions/common/extension.h"
32 #include "net/url_request/url_request_context_getter.h" 33 #include "net/url_request/url_request_context_getter.h"
33 #include "policy/proto/cloud_policy.pb.h" 34 #include "policy/proto/cloud_policy.pb.h"
34 #include "testing/gmock/include/gmock/gmock.h" 35 #include "testing/gmock/include/gmock/gmock.h"
35 #include "testing/gtest/include/gtest/gtest.h" 36 #include "testing/gtest/include/gtest/gtest.h"
36 37
37 #if defined(OS_CHROMEOS) 38 #if defined(OS_CHROMEOS)
38 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" 39 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
39 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" 40 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h"
40 #include "chromeos/chromeos_switches.h" 41 #include "chromeos/chromeos_switches.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 112
112 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 113 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
113 test_server_.RegisterClient(kDMToken, kDeviceID); 114 test_server_.RegisterClient(kDMToken, kDeviceID);
114 EXPECT_TRUE(test_server_.UpdatePolicyData( 115 EXPECT_TRUE(test_server_.UpdatePolicyData(
115 dm_protocol::kChromeExtensionPolicyType, kTestExtension, kTestPolicy)); 116 dm_protocol::kChromeExtensionPolicyType, kTestExtension, kTestPolicy));
116 ASSERT_TRUE(test_server_.Start()); 117 ASSERT_TRUE(test_server_.Start());
117 118
118 std::string url = test_server_.GetServiceURL().spec(); 119 std::string url = test_server_.GetServiceURL().spec();
119 CommandLine* command_line = CommandLine::ForCurrentProcess(); 120 CommandLine* command_line = CommandLine::ForCurrentProcess();
120 command_line->AppendSwitchASCII(::switches::kDeviceManagementUrl, url); 121 command_line->AppendSwitchASCII(::switches::kDeviceManagementUrl, url);
122 command_line->AppendSwitch(switches::kEnableComponentCloudPolicy);
121 123
122 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); 124 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture();
123 } 125 }
124 126
125 virtual void SetUpOnMainThread() OVERRIDE { 127 virtual void SetUpOnMainThread() OVERRIDE {
126 ASSERT_TRUE(PolicyServiceIsEmpty(g_browser_process->policy_service())) 128 ASSERT_TRUE(PolicyServiceIsEmpty(g_browser_process->policy_service()))
127 << "Pre-existing policies in this machine will make this test fail."; 129 << "Pre-existing policies in this machine will make this test fail.";
128 130
129 // Install the initial extension. 131 // Install the initial extension.
130 ExtensionTestMessageListener ready_listener("ready", true); 132 ExtensionTestMessageListener ready_listener("ready", true);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 ExtensionTestMessageListener signin_policy_listener(kTestPolicyJSON, true); 328 ExtensionTestMessageListener signin_policy_listener(kTestPolicyJSON, true);
327 event_listener2.Reply("get-policy-Name"); 329 event_listener2.Reply("get-policy-Name");
328 EXPECT_TRUE(signin_policy_listener.WaitUntilSatisfied()); 330 EXPECT_TRUE(signin_policy_listener.WaitUntilSatisfied());
329 331
330 // And the cache is back. 332 // And the cache is back.
331 EXPECT_TRUE(base::PathExists(cache_path)); 333 EXPECT_TRUE(base::PathExists(cache_path));
332 } 334 }
333 #endif 335 #endif
334 336
335 } // namespace policy 337 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/cloud_policy_manager.cc ('k') | components/policy/core/common/policy_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698