2014-10-21 10:16:19 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef FAKE_DECRYPTOR_H__
|
|
|
|
#define FAKE_DECRYPTOR_H__
|
|
|
|
|
|
|
|
#include "gmp-decryption.h"
|
|
|
|
#include <string>
|
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
|
2017-01-16 05:12:15 +03:00
|
|
|
class FakeDecryptor : public GMPDecryptor {
|
2014-10-21 10:16:19 +04:00
|
|
|
public:
|
|
|
|
|
2017-01-19 04:57:30 +03:00
|
|
|
explicit FakeDecryptor();
|
2014-10-21 10:16:19 +04:00
|
|
|
|
2017-01-16 05:12:15 +03:00
|
|
|
void Init(GMPDecryptorCallback* aCallback,
|
|
|
|
bool aDistinctiveIdentifierRequired,
|
|
|
|
bool aPersistentStateRequired) override
|
|
|
|
{
|
2014-10-21 10:16:19 +04:00
|
|
|
mCallback = aCallback;
|
|
|
|
}
|
|
|
|
|
2016-01-18 06:40:49 +03:00
|
|
|
void CreateSession(uint32_t aCreateSessionToken,
|
|
|
|
uint32_t aPromiseId,
|
|
|
|
const char* aInitDataType,
|
|
|
|
uint32_t aInitDataTypeSize,
|
|
|
|
const uint8_t* aInitData,
|
|
|
|
uint32_t aInitDataSize,
|
|
|
|
GMPSessionType aSessionType) override
|
2014-10-21 10:16:19 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-01-18 06:40:49 +03:00
|
|
|
void LoadSession(uint32_t aPromiseId,
|
|
|
|
const char* aSessionId,
|
|
|
|
uint32_t aSessionIdLength) override
|
2014-10-21 10:16:19 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-01-18 06:40:49 +03:00
|
|
|
void UpdateSession(uint32_t aPromiseId,
|
|
|
|
const char* aSessionId,
|
|
|
|
uint32_t aSessionIdLength,
|
|
|
|
const uint8_t* aResponse,
|
|
|
|
uint32_t aResponseSize) override;
|
2014-10-21 10:16:19 +04:00
|
|
|
|
2016-01-18 06:40:49 +03:00
|
|
|
void CloseSession(uint32_t aPromiseId,
|
|
|
|
const char* aSessionId,
|
|
|
|
uint32_t aSessionIdLength) override
|
2014-10-21 10:16:19 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-01-18 06:40:49 +03:00
|
|
|
void RemoveSession(uint32_t aPromiseId,
|
|
|
|
const char* aSessionId,
|
|
|
|
uint32_t aSessionIdLength) override
|
2014-10-21 10:16:19 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-01-18 06:40:49 +03:00
|
|
|
void SetServerCertificate(uint32_t aPromiseId,
|
|
|
|
const uint8_t* aServerCert,
|
|
|
|
uint32_t aServerCertSize) override
|
2014-10-21 10:16:19 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-01-18 06:40:49 +03:00
|
|
|
void Decrypt(GMPBuffer* aBuffer,
|
2017-02-27 03:58:27 +03:00
|
|
|
GMPEncryptedBufferMetadata* aMetadata) override
|
2014-10-21 10:16:19 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-01-18 06:40:49 +03:00
|
|
|
void DecryptingComplete() override;
|
2014-10-21 10:16:19 +04:00
|
|
|
|
|
|
|
static void Message(const std::string& aMessage);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2014-10-23 11:37:55 +04:00
|
|
|
virtual ~FakeDecryptor() {}
|
2014-10-21 10:16:19 +04:00
|
|
|
static FakeDecryptor* sInstance;
|
|
|
|
|
|
|
|
void TestStorage();
|
|
|
|
|
|
|
|
GMPDecryptorCallback* mCallback;
|
2014-10-23 11:37:55 +04:00
|
|
|
};
|
|
|
|
|
2014-10-21 10:16:19 +04:00
|
|
|
#endif
|