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