tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

cdm-test-storage.h (1652B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #ifndef TEST_CDM_STORAGE_H__
      7 #define TEST_CDM_STORAGE_H__
      8 
      9 #include <cstdint>
     10 #include <functional>
     11 #include <string>
     12 
     13 #include "content_decryption_module.h"
     14 
     15 #define IO_SUCCEEDED(x) ((x) == cdm::FileIOClient::Status::kSuccess)
     16 #define IO_FAILED(x) ((x) != cdm::FileIOClient::Status::kSuccess)
     17 
     18 class ReadContinuation {
     19 public:
     20  virtual ~ReadContinuation() = default;
     21  virtual void operator()(bool aSuccess, const uint8_t* aData,
     22                          uint32_t aDataSize) = 0;
     23 };
     24 
     25 void WriteRecord(cdm::Host_11* aHost, const std::string& aRecordName,
     26                 const std::string& aData, std::function<void()>&& aOnSuccess,
     27                 std::function<void()>&& aOnFailure);
     28 
     29 void WriteRecord(cdm::Host_11* aHost, const std::string& aRecordName,
     30                 const uint8_t* aData, uint32_t aNumBytes,
     31                 std::function<void()>&& aOnSuccess,
     32                 std::function<void()>&& aOnFailure);
     33 
     34 void ReadRecord(
     35    cdm::Host_11* aHost, const std::string& aRecordName,
     36    std::function<void(bool, const uint8_t*, uint32_t)>&& aOnReadComplete);
     37 
     38 class OpenContinuation {
     39 public:
     40  virtual ~OpenContinuation() = default;
     41  virtual void operator()(bool aSuccess) = 0;
     42 };
     43 
     44 void OpenRecord(cdm::Host_11* aHost, const std::string& aRecordName,
     45                std::function<void(bool)>&& aOpenComplete);
     46 #endif  // TEST_CDM_STORAGE_H__