| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 m_result->completeWithArrayBuffer(buffer); | 96 m_result->completeWithArrayBuffer(buffer); |
| 97 delete this; | 97 delete this; |
| 98 } | 98 } |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 SHA1 m_sha1; | 101 SHA1 m_sha1; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 class MockPlatformCrypto : public WebKit::WebCrypto { | 104 class MockPlatformCrypto : public WebKit::WebCrypto { |
| 105 public: | 105 public: |
| 106 // FIXME: delete | 106 virtual void digest(const WebKit::WebCryptoAlgorithm& algorithm, WebKit::Web
CryptoOperationResult* result) OVERRIDE |
| 107 virtual WebKit::WebCryptoOperation* digest(const WebKit::WebCryptoAlgorithm&
) { return 0; } | |
| 108 | |
| 109 virtual void digest2(const WebKit::WebCryptoAlgorithm& algorithm, WebKit::We
bCryptoOperationResult* result) OVERRIDE | |
| 110 { | 107 { |
| 111 if (algorithm.id() == WebKit::WebCryptoAlgorithmIdSha1) { | 108 if (algorithm.id() == WebKit::WebCryptoAlgorithmIdSha1) { |
| 112 result->initializationSucceded(new MockSha1Operation(result)); | 109 result->initializationSucceded(new MockSha1Operation(result)); |
| 113 } else { | 110 } else { |
| 114 // Don't fail synchronously, since existing layout tests rely on | 111 // Don't fail synchronously, since existing layout tests rely on |
| 115 // digest for testing algorithm normalization. | 112 // digest for testing algorithm normalization. |
| 116 result->initializationSucceded(new DummyOperation(result)); | 113 result->initializationSucceded(new DummyOperation(result)); |
| 117 } | 114 } |
| 118 } | 115 } |
| 119 }; | 116 }; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 if (!platformCrypto) { | 166 if (!platformCrypto) { |
| 170 ec = NotSupportedError; | 167 ec = NotSupportedError; |
| 171 return 0; | 168 return 0; |
| 172 } | 169 } |
| 173 | 170 |
| 174 WebKit::WebCryptoAlgorithm algorithm; | 171 WebKit::WebCryptoAlgorithm algorithm; |
| 175 if (!normalizeAlgorithm(rawAlgorithm, Digest, algorithm, ec)) | 172 if (!normalizeAlgorithm(rawAlgorithm, Digest, algorithm, ec)) |
| 176 return 0; | 173 return 0; |
| 177 | 174 |
| 178 RefPtr<CryptoOperation> op = CryptoOperation::create(algorithm, &ec); | 175 RefPtr<CryptoOperation> op = CryptoOperation::create(algorithm, &ec); |
| 179 platformCrypto->digest2(algorithm, op.get()); | 176 platformCrypto->digest(algorithm, op.get()); |
| 180 return op.release(); | 177 return op.release(); |
| 181 } | 178 } |
| 182 | 179 |
| 183 } // namespace WebCore | 180 } // namespace WebCore |
| OLD | NEW |