OLD | NEW |
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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 #endif | 99 #endif |
100 | 100 |
101 } // namespace | 101 } // namespace |
102 | 102 |
103 class ComponentCloudPolicyTest : public ExtensionBrowserTest { | 103 class ComponentCloudPolicyTest : public ExtensionBrowserTest { |
104 protected: | 104 protected: |
105 ComponentCloudPolicyTest() {} | 105 ComponentCloudPolicyTest() {} |
106 virtual ~ComponentCloudPolicyTest() {} | 106 virtual ~ComponentCloudPolicyTest() {} |
107 | 107 |
108 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 108 virtual void SetUpCommandLine(CommandLine* command_line) override { |
109 ExtensionBrowserTest::SetUpCommandLine(command_line); | 109 ExtensionBrowserTest::SetUpCommandLine(command_line); |
110 #if defined(OS_CHROMEOS) | 110 #if defined(OS_CHROMEOS) |
111 // ExtensionBrowserTest sets the login users to a non-managed value; | 111 // ExtensionBrowserTest sets the login users to a non-managed value; |
112 // replace it. This is the default username sent in policy blobs from the | 112 // replace it. This is the default username sent in policy blobs from the |
113 // testserver. | 113 // testserver. |
114 command_line->AppendSwitchASCII( | 114 command_line->AppendSwitchASCII( |
115 ::chromeos::switches::kLoginUser, "user@example.com"); | 115 ::chromeos::switches::kLoginUser, "user@example.com"); |
116 #endif | 116 #endif |
117 } | 117 } |
118 | 118 |
119 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 119 virtual void SetUpInProcessBrowserTestFixture() override { |
120 test_server_.RegisterClient(kDMToken, kDeviceID); | 120 test_server_.RegisterClient(kDMToken, kDeviceID); |
121 EXPECT_TRUE(test_server_.UpdatePolicyData( | 121 EXPECT_TRUE(test_server_.UpdatePolicyData( |
122 dm_protocol::kChromeExtensionPolicyType, kTestExtension, kTestPolicy)); | 122 dm_protocol::kChromeExtensionPolicyType, kTestExtension, kTestPolicy)); |
123 ASSERT_TRUE(test_server_.Start()); | 123 ASSERT_TRUE(test_server_.Start()); |
124 | 124 |
125 std::string url = test_server_.GetServiceURL().spec(); | 125 std::string url = test_server_.GetServiceURL().spec(); |
126 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 126 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
127 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, url); | 127 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, url); |
128 | 128 |
129 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); | 129 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); |
130 } | 130 } |
131 | 131 |
132 virtual void SetUpOnMainThread() OVERRIDE { | 132 virtual void SetUpOnMainThread() override { |
133 ASSERT_TRUE(PolicyServiceIsEmpty(g_browser_process->policy_service())) | 133 ASSERT_TRUE(PolicyServiceIsEmpty(g_browser_process->policy_service())) |
134 << "Pre-existing policies in this machine will make this test fail."; | 134 << "Pre-existing policies in this machine will make this test fail."; |
135 | 135 |
136 // Install the initial extension. | 136 // Install the initial extension. |
137 ExtensionTestMessageListener ready_listener("ready", true); | 137 ExtensionTestMessageListener ready_listener("ready", true); |
138 event_listener_.reset(new ExtensionTestMessageListener("event", true)); | 138 event_listener_.reset(new ExtensionTestMessageListener("event", true)); |
139 extension_ = LoadExtension(kTestExtensionPath); | 139 extension_ = LoadExtension(kTestExtensionPath); |
140 ASSERT_TRUE(extension_.get()); | 140 ASSERT_TRUE(extension_.get()); |
141 ASSERT_EQ(kTestExtension, extension_->id()); | 141 ASSERT_EQ(kTestExtension, extension_->id()); |
142 EXPECT_TRUE(ready_listener.WaitUntilSatisfied()); | 142 EXPECT_TRUE(ready_listener.WaitUntilSatisfied()); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 ExtensionTestMessageListener signin_policy_listener(kTestPolicyJSON, true); | 338 ExtensionTestMessageListener signin_policy_listener(kTestPolicyJSON, true); |
339 event_listener2.Reply("get-policy-Name"); | 339 event_listener2.Reply("get-policy-Name"); |
340 EXPECT_TRUE(signin_policy_listener.WaitUntilSatisfied()); | 340 EXPECT_TRUE(signin_policy_listener.WaitUntilSatisfied()); |
341 | 341 |
342 // And the cache is back. | 342 // And the cache is back. |
343 EXPECT_TRUE(base::PathExists(cache_path)); | 343 EXPECT_TRUE(base::PathExists(cache_path)); |
344 } | 344 } |
345 #endif | 345 #endif |
346 | 346 |
347 } // namespace policy | 347 } // namespace policy |
OLD | NEW |