| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 "{" | 80 "{" |
| 81 " \"Another\": {" | 81 " \"Another\": {" |
| 82 " \"Value\": \"turn_it_off\"" | 82 " \"Value\": \"turn_it_off\"" |
| 83 " }" | 83 " }" |
| 84 "}"; | 84 "}"; |
| 85 | 85 |
| 86 const char kTestPolicy2JSON[] = "{\"Another\":\"turn_it_off\"}"; | 86 const char kTestPolicy2JSON[] = "{\"Another\":\"turn_it_off\"}"; |
| 87 | 87 |
| 88 // Same encoding as ResourceCache does for its keys. | 88 // Same encoding as ResourceCache does for its keys. |
| 89 bool Base64Encode(const std::string& value, std::string* encoded) { | 89 bool Base64Encode(const std::string& value, std::string* encoded) { |
| 90 if (value.empty() || !base::Base64Encode(value, encoded)) | 90 if (value.empty()) |
| 91 return false; | 91 return false; |
| 92 base::Base64Encode(value, encoded); |
| 92 base::ReplaceChars(*encoded, "+", "-", encoded); | 93 base::ReplaceChars(*encoded, "+", "-", encoded); |
| 93 base::ReplaceChars(*encoded, "/", "_", encoded); | 94 base::ReplaceChars(*encoded, "/", "_", encoded); |
| 94 return true; | 95 return true; |
| 95 } | 96 } |
| 96 | 97 |
| 97 class ComponentCloudPolicyTest : public ExtensionBrowserTest { | 98 class ComponentCloudPolicyTest : public ExtensionBrowserTest { |
| 98 protected: | 99 protected: |
| 99 ComponentCloudPolicyTest() {} | 100 ComponentCloudPolicyTest() {} |
| 100 virtual ~ComponentCloudPolicyTest() {} | 101 virtual ~ComponentCloudPolicyTest() {} |
| 101 | 102 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 ExtensionTestMessageListener signin_policy_listener(kTestPolicyJSON, true); | 329 ExtensionTestMessageListener signin_policy_listener(kTestPolicyJSON, true); |
| 329 event_listener2.Reply("get-policy-Name"); | 330 event_listener2.Reply("get-policy-Name"); |
| 330 EXPECT_TRUE(signin_policy_listener.WaitUntilSatisfied()); | 331 EXPECT_TRUE(signin_policy_listener.WaitUntilSatisfied()); |
| 331 | 332 |
| 332 // And the cache is back. | 333 // And the cache is back. |
| 333 EXPECT_TRUE(base::PathExists(cache_path)); | 334 EXPECT_TRUE(base::PathExists(cache_path)); |
| 334 } | 335 } |
| 335 #endif | 336 #endif |
| 336 | 337 |
| 337 } // namespace policy | 338 } // namespace policy |
| OLD | NEW |