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 <vector> | 10 #include <vector> |
(...skipping 27 matching lines...) Expand all Loading... |
38 return false; | 38 return false; |
39 } | 39 } |
40 | 40 |
41 if (!result_list->GetBoolean(0, result)) { | 41 if (!result_list->GetBoolean(0, result)) { |
42 LOG(ERROR) << "Result is not boolean."; | 42 LOG(ERROR) << "Result is not boolean."; |
43 return false; | 43 return false; |
44 } | 44 } |
45 return true; | 45 return true; |
46 } | 46 } |
47 | 47 |
48 bool GetCanOriginAssertAppIdResult(std::string origin, std::string appId) { | 48 bool GetCanOriginAssertAppIdResult(const std::string& origin, |
| 49 const std::string& appId) { |
49 scoped_refptr<api::CryptotokenPrivateCanOriginAssertAppIdFunction> function( | 50 scoped_refptr<api::CryptotokenPrivateCanOriginAssertAppIdFunction> function( |
50 new api::CryptotokenPrivateCanOriginAssertAppIdFunction()); | 51 new api::CryptotokenPrivateCanOriginAssertAppIdFunction()); |
51 function->set_has_callback(true); | 52 function->set_has_callback(true); |
52 | 53 |
53 scoped_ptr<base::ListValue> args(new base::ListValue); | 54 scoped_ptr<base::ListValue> args(new base::ListValue); |
54 args->AppendString(origin); | 55 args->AppendString(origin); |
55 args->AppendString(appId); | 56 args->AppendString(appId); |
56 | 57 |
57 extension_function_test_utils::RunFunction( | 58 extension_function_test_utils::RunFunction( |
58 function.get(), | 59 function.get(), |
(...skipping 27 matching lines...) Expand all Loading... |
86 std::string gstatic_appid("https://www.gstatic.com/securitykey/origins.json"); | 87 std::string gstatic_appid("https://www.gstatic.com/securitykey/origins.json"); |
87 EXPECT_TRUE(GetCanOriginAssertAppIdResult(google_origin, gstatic_appid)); | 88 EXPECT_TRUE(GetCanOriginAssertAppIdResult(google_origin, gstatic_appid)); |
88 // Not all gstatic urls are allowed, just those specifically whitelisted. | 89 // Not all gstatic urls are allowed, just those specifically whitelisted. |
89 std::string gstatic_otherurl("https://www.gstatic.com/foobar"); | 90 std::string gstatic_otherurl("https://www.gstatic.com/foobar"); |
90 EXPECT_FALSE(GetCanOriginAssertAppIdResult(google_origin, gstatic_otherurl)); | 91 EXPECT_FALSE(GetCanOriginAssertAppIdResult(google_origin, gstatic_otherurl)); |
91 } | 92 } |
92 | 93 |
93 } // namespace | 94 } // namespace |
94 | 95 |
95 } // namespace extensions | 96 } // namespace extensions |
OLD | NEW |