OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 namespace { | 42 namespace { |
43 | 43 |
44 class MockCryptoOperation : public WebKit::WebCryptoOperation { | 44 class MockCryptoOperation : public WebKit::WebCryptoOperation { |
45 public: | 45 public: |
46 MockCryptoOperation(const WebKit::WebCryptoAlgorithm& algorithm, const WebKi
t::WebCryptoOperationResult& result) : m_algorithm(algorithm), m_result(result)
{ } | 46 MockCryptoOperation(const WebKit::WebCryptoAlgorithm& algorithm, const WebKi
t::WebCryptoOperationResult& result) : m_algorithm(algorithm), m_result(result)
{ } |
47 | 47 |
48 virtual void process(const unsigned char* bytes, size_t size) OVERRIDE | 48 virtual void process(const unsigned char* bytes, size_t size) OVERRIDE |
49 { | 49 { |
50 // Don't buffer too much data. | 50 // Don't buffer too much data. |
51 if (m_data.size() + size > 6) | 51 if (m_data.size() + size > 6) { |
52 m_result.completeWithError(); | 52 m_result.completeWithError(); |
| 53 delete this; |
| 54 return; |
| 55 } |
53 | 56 |
54 if (size) | 57 if (size) |
55 m_data.append(reinterpret_cast<const char*>(bytes), size); | 58 m_data.append(reinterpret_cast<const char*>(bytes), size); |
56 } | 59 } |
57 | 60 |
58 virtual void abort() OVERRIDE | 61 virtual void abort() OVERRIDE |
59 { | 62 { |
60 delete this; | 63 delete this; |
61 } | 64 } |
62 | 65 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 if (keyDataString == "public") { | 126 if (keyDataString == "public") { |
124 type = WebKit::WebCryptoKeyTypePublic; | 127 type = WebKit::WebCryptoKeyTypePublic; |
125 } else if (keyDataString == "private") { | 128 } else if (keyDataString == "private") { |
126 type = WebKit::WebCryptoKeyTypePrivate; | 129 type = WebKit::WebCryptoKeyTypePrivate; |
127 } | 130 } |
128 result.completeWithKey(WebKit::WebCryptoKey::create(0, type, extractable
, algorithm, usages)); | 131 result.completeWithKey(WebKit::WebCryptoKey::create(0, type, extractable
, algorithm, usages)); |
129 } | 132 } |
130 } | 133 } |
131 | 134 |
132 } // namespace WebTestRunner | 135 } // namespace WebTestRunner |
OLD | NEW |