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 "gmp-async-shutdown.h"
|
|
|
|
#include <string>
|
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
|
|
|
|
class FakeDecryptor : public GMPDecryptor {
|
|
|
|
public:
|
|
|
|
|
2014-12-11 01:49:09 +03:00
|
|
|
explicit FakeDecryptor(GMPDecryptorHost* aHost);
|
2014-10-21 10:16:19 +04:00
|
|
|
|
|
|
|
virtual void Init(GMPDecryptorCallback* aCallback) MOZ_OVERRIDE {
|
|
|
|
mCallback = aCallback;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void CreateSession(uint32_t aPromiseId,
|
|
|
|
const char* aInitDataType,
|
|
|
|
uint32_t aInitDataTypeSize,
|
|
|
|
const uint8_t* aInitData,
|
|
|
|
uint32_t aInitDataSize,
|
|
|
|
GMPSessionType aSessionType) MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void LoadSession(uint32_t aPromiseId,
|
|
|
|
const char* aSessionId,
|
|
|
|
uint32_t aSessionIdLength) MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void UpdateSession(uint32_t aPromiseId,
|
|
|
|
const char* aSessionId,
|
|
|
|
uint32_t aSessionIdLength,
|
|
|
|
const uint8_t* aResponse,
|
|
|
|
uint32_t aResponseSize) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual void CloseSession(uint32_t aPromiseId,
|
|
|
|
const char* aSessionId,
|
|
|
|
uint32_t aSessionIdLength) MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void RemoveSession(uint32_t aPromiseId,
|
|
|
|
const char* aSessionId,
|
|
|
|
uint32_t aSessionIdLength) MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void SetServerCertificate(uint32_t aPromiseId,
|
|
|
|
const uint8_t* aServerCert,
|
|
|
|
uint32_t aServerCertSize) MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Decrypt(GMPBuffer* aBuffer,
|
|
|
|
GMPEncryptedBufferMetadata* aMetadata) MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void DecryptingComplete() MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
static void Message(const std::string& aMessage);
|
|
|
|
|
2014-11-21 02:25:12 +03:00
|
|
|
void ProcessRecordNames(GMPRecordIterator* aRecordIterator,
|
|
|
|
GMPErr aStatus);
|
|
|
|
|
2014-10-21 10:16:19 +04:00
|
|
|
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-11-14 11:39:39 +03:00
|
|
|
GMPDecryptorHost* mHost;
|
2014-10-23 11:37:55 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
class TestAsyncShutdown : public GMPAsyncShutdown {
|
|
|
|
public:
|
2014-10-11 01:28:35 +04:00
|
|
|
explicit TestAsyncShutdown(GMPAsyncShutdownHost* aHost)
|
2014-10-23 11:37:55 +04:00
|
|
|
: mHost(aHost)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
virtual void BeginShutdown() MOZ_OVERRIDE;
|
|
|
|
private:
|
|
|
|
GMPAsyncShutdownHost* mHost;
|
2014-10-21 10:16:19 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|