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/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 EXPECT_TRUE(policy_listener1.WaitUntilSatisfied()); | 262 EXPECT_TRUE(policy_listener1.WaitUntilSatisfied()); |
263 | 263 |
264 ExtensionTestMessageListener policy_listener2(kTestPolicy2JSON, true); | 264 ExtensionTestMessageListener policy_listener2(kTestPolicy2JSON, true); |
265 policy_listener1.Reply("get-policy-Another"); | 265 policy_listener1.Reply("get-policy-Another"); |
266 EXPECT_TRUE(policy_listener2.WaitUntilSatisfied()); | 266 EXPECT_TRUE(policy_listener2.WaitUntilSatisfied()); |
267 } | 267 } |
268 | 268 |
269 IN_PROC_BROWSER_TEST_F(ComponentCloudPolicyTest, InstallNewExtension) { | 269 IN_PROC_BROWSER_TEST_F(ComponentCloudPolicyTest, InstallNewExtension) { |
270 EXPECT_TRUE(test_server_.UpdatePolicyData( | 270 EXPECT_TRUE(test_server_.UpdatePolicyData( |
271 dm_protocol::kChromeExtensionPolicyType, kTestExtension2, kTestPolicy2)); | 271 dm_protocol::kChromeExtensionPolicyType, kTestExtension2, kTestPolicy2)); |
| 272 // Installing a new extension doesn't trigger another policy fetch because |
| 273 // the server always sends down the list of all extensions that have policy. |
| 274 // Fetch now that the configuration has been updated and before installing |
| 275 // the extension. |
| 276 RefreshPolicies(); |
272 | 277 |
273 ExtensionTestMessageListener result_listener("ok", true); | 278 ExtensionTestMessageListener result_listener("ok", true); |
274 result_listener.set_failure_message("fail"); | 279 result_listener.set_failure_message("fail"); |
275 scoped_refptr<const extensions::Extension> extension2 = | 280 scoped_refptr<const extensions::Extension> extension2 = |
276 LoadExtension(kTestExtension2Path); | 281 LoadExtension(kTestExtension2Path); |
277 ASSERT_TRUE(extension2.get()); | 282 ASSERT_TRUE(extension2.get()); |
278 ASSERT_EQ(kTestExtension2, extension2->id()); | 283 ASSERT_EQ(kTestExtension2, extension2->id()); |
279 | 284 |
280 // This extension only sends the 'policy' signal once it receives the policy, | 285 // This extension only sends the 'policy' signal once it receives the policy, |
281 // and after verifying it has the expected value. Otherwise it sends 'fail'. | 286 // and after verifying it has the expected value. Otherwise it sends 'fail'. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 ExtensionTestMessageListener signin_policy_listener(kTestPolicyJSON, true); | 338 ExtensionTestMessageListener signin_policy_listener(kTestPolicyJSON, true); |
334 event_listener2.Reply("get-policy-Name"); | 339 event_listener2.Reply("get-policy-Name"); |
335 EXPECT_TRUE(signin_policy_listener.WaitUntilSatisfied()); | 340 EXPECT_TRUE(signin_policy_listener.WaitUntilSatisfied()); |
336 | 341 |
337 // And the cache is back. | 342 // And the cache is back. |
338 EXPECT_TRUE(base::PathExists(cache_path)); | 343 EXPECT_TRUE(base::PathExists(cache_path)); |
339 } | 344 } |
340 #endif | 345 #endif |
341 | 346 |
342 } // namespace policy | 347 } // namespace policy |
OLD | NEW |