OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_
api.h" | 5 #include "chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_
api.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 return true; | 46 return true; |
47 } | 47 } |
48 | 48 |
49 bool GetCanOriginAssertAppIdResult(const std::string& origin, | 49 bool GetCanOriginAssertAppIdResult(const std::string& origin, |
50 const std::string& appId) { | 50 const std::string& appId) { |
51 scoped_refptr<api::CryptotokenPrivateCanOriginAssertAppIdFunction> function( | 51 scoped_refptr<api::CryptotokenPrivateCanOriginAssertAppIdFunction> function( |
52 new api::CryptotokenPrivateCanOriginAssertAppIdFunction()); | 52 new api::CryptotokenPrivateCanOriginAssertAppIdFunction()); |
53 function->set_has_callback(true); | 53 function->set_has_callback(true); |
54 | 54 |
55 scoped_ptr<base::ListValue> args(new base::ListValue); | 55 std::unique_ptr<base::ListValue> args(new base::ListValue); |
56 args->AppendString(origin); | 56 args->AppendString(origin); |
57 args->AppendString(appId); | 57 args->AppendString(appId); |
58 | 58 |
59 extension_function_test_utils::RunFunction( | 59 extension_function_test_utils::RunFunction( |
60 function.get(), std::move(args), browser(), | 60 function.get(), std::move(args), browser(), |
61 extension_function_test_utils::NONE); | 61 extension_function_test_utils::NONE); |
62 | 62 |
63 bool result; | 63 bool result; |
64 GetSingleBooleanResult(function.get(), &result); | 64 GetSingleBooleanResult(function.get(), &result); |
65 return result; | 65 return result; |
(...skipping 20 matching lines...) Expand all Loading... |
86 std::string gstatic_appid("https://www.gstatic.com/securitykey/origins.json"); | 86 std::string gstatic_appid("https://www.gstatic.com/securitykey/origins.json"); |
87 EXPECT_TRUE(GetCanOriginAssertAppIdResult(google_origin, gstatic_appid)); | 87 EXPECT_TRUE(GetCanOriginAssertAppIdResult(google_origin, gstatic_appid)); |
88 // Not all gstatic urls are allowed, just those specifically whitelisted. | 88 // Not all gstatic urls are allowed, just those specifically whitelisted. |
89 std::string gstatic_otherurl("https://www.gstatic.com/foobar"); | 89 std::string gstatic_otherurl("https://www.gstatic.com/foobar"); |
90 EXPECT_FALSE(GetCanOriginAssertAppIdResult(google_origin, gstatic_otherurl)); | 90 EXPECT_FALSE(GetCanOriginAssertAppIdResult(google_origin, gstatic_otherurl)); |
91 } | 91 } |
92 | 92 |
93 } // namespace | 93 } // namespace |
94 | 94 |
95 } // namespace extensions | 95 } // namespace extensions |
OLD | NEW |