Files
android/libwvdrmengine/cdm/core/test/reboot_test.h
Fred Gylys-Colwell 9cab445e2c Add initial reboot test infrastructure
Merge from Widevine repo of http://go/wvgerrit/130469
Parse and decode persistent data for reboot tests

Merge from Widevine repo of http://go/wvgerrit/130468
Save and restore persistent test data

Merge from Widevine repo of http://go/wvgerrit/130467
Saving and restore the test host's file system

Merge from Widevine repo of http://go/wvgerrit/130466
Add reboot test class

Test: android/run_reboot_test.sh and jenkins/run_fake_l1_tests
Bug: 194342751
Bug: 194342800
Change-Id: Id2f3d9850cb75cb286f7863738aa8fd38a1a5301
2021-10-14 17:50:14 +00:00

55 lines
1.8 KiB
C++

// Copyright 2021 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine License
// Agreement.
#ifndef WVCDM_CORE_REBOOT_TEST_H_
#define WVCDM_CORE_REBOOT_TEST_H_
#include <map>
#include <string>
#include <vector>
#include <gtest/gtest.h>
#include "file_store.h"
#include "test_base.h"
namespace wvcdm {
class RebootTest : public WvCdmTestBaseWithEngine {
public:
// The main test driver may inject the file system for saving persistent test
// data.
static void set_file_system(FileSystem* file_system) {
file_system_ = file_system;
}
// Dump a map to a std string in an almost human readable way so that the map
// can be rebuilt using ParseDump below. The keys in the map must be standard
// identifier strings, which means no special characters or whitespace. By
// "almost human readable", we mean that a human debugging the dump will be
// able to find the keys, and see the values if they are printable or see a
// hex dump of the values if they are not.
static std::string DumpData(const std::map<std::string, std::string>& data);
// Parse a dump generated by DumpData and recreate the original data map.
// Returns true on success.
static bool ParseDump(const std::string& dump,
std::map<std::string, std::string>* data);
static int test_pass() { return default_config_.test_pass(); }
protected:
void SetUp() override;
void TearDown() override;
// This is used to store each test's persistent data.
static FileSystem* file_system_;
// The persistent data for the current test.
std::map<std::string, std::string> persistent_data_;
// Where to store and restore the persistent data for a single test.
std::string persistent_data_filename_;
};
} // namespace wvcdm
#endif // WVCDM_CORE_REBOOT_TEST_H_