OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_CHILD_WEBCRYPTO_TEST_TEST_HELPERS_H_ | 5 #ifndef COMPONENTS_WEBCRYPTO_TEST_TEST_HELPERS_H_ |
6 #define CONTENT_CHILD_WEBCRYPTO_TEST_TEST_HELPERS_H_ | 6 #define COMPONENTS_WEBCRYPTO_TEST_TEST_HELPERS_H_ |
7 | 7 |
8 #include <ostream> | 8 #include <ostream> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" | 14 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" |
15 #include "third_party/WebKit/public/platform/WebCryptoKey.h" | 15 #include "third_party/WebKit/public/platform/WebCryptoKey.h" |
16 | 16 |
17 #define EXPECT_BYTES_EQ(expected, actual) \ | 17 #define EXPECT_BYTES_EQ(expected, actual) \ |
18 EXPECT_EQ(CryptoData(expected), CryptoData(actual)) | 18 EXPECT_EQ(CryptoData(expected), CryptoData(actual)) |
19 | 19 |
20 #define EXPECT_BYTES_EQ_HEX(expected_hex, actual_bytes) \ | 20 #define EXPECT_BYTES_EQ_HEX(expected_hex, actual_bytes) \ |
21 EXPECT_BYTES_EQ(HexStringToBytes(expected_hex), actual_bytes) | 21 EXPECT_BYTES_EQ(HexStringToBytes(expected_hex), actual_bytes) |
22 | 22 |
23 namespace base { | 23 namespace base { |
24 class DictionaryValue; | 24 class DictionaryValue; |
25 class ListValue; | 25 class ListValue; |
26 class Value; | 26 class Value; |
27 } | 27 } |
28 | 28 |
29 namespace blink { | 29 namespace blink { |
30 class WebCryptoAlgorithm; | 30 class WebCryptoAlgorithm; |
31 } | 31 } |
32 | 32 |
33 namespace content { | |
34 | |
35 namespace webcrypto { | 33 namespace webcrypto { |
36 | 34 |
37 class Status; | 35 class Status; |
38 class CryptoData; | 36 class CryptoData; |
39 | 37 |
40 // These functions are used by GTEST to support EXPECT_EQ() for | 38 // These functions are used by GTEST to support EXPECT_EQ() for |
41 // webcrypto::Status and webcrypto::CryptoData | 39 // webcrypto::Status and webcrypto::CryptoData |
42 | 40 |
43 void PrintTo(const Status& status, ::std::ostream* os); | 41 void PrintTo(const Status& status, ::std::ostream* os); |
44 bool operator==(const Status& a, const Status& b); | 42 bool operator==(const Status& a, const Status& b); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 const base::DictionaryValue* test, | 198 const base::DictionaryValue* test, |
201 blink::WebCryptoKeyFormat key_format); | 199 blink::WebCryptoKeyFormat key_format); |
202 | 200 |
203 // Reads the "crv" string from a JSON test case and returns it as a | 201 // Reads the "crv" string from a JSON test case and returns it as a |
204 // WebCryptoNamedCurve. | 202 // WebCryptoNamedCurve. |
205 blink::WebCryptoNamedCurve GetCurveNameFromDictionary( | 203 blink::WebCryptoNamedCurve GetCurveNameFromDictionary( |
206 const base::DictionaryValue* dict); | 204 const base::DictionaryValue* dict); |
207 | 205 |
208 } // namespace webcrypto | 206 } // namespace webcrypto |
209 | 207 |
210 } // namesapce content | 208 #endif // COMPONENTS_WEBCRYPTO_TEST_TEST_HELPERS_H_ |
211 | |
212 #endif // CONTENT_CHILD_WEBCRYPTO_TEST_TEST_HELPERS_H_ | |
OLD | NEW |