[ Merge of http://go/wvgerrit/193190 ] This changes the persistent test storage to use protobufs instead of manual parsing. This simplifies the code but makes the files less "human readable". Files can be read using 'gqui' if needed. Bug: 312529037 Test: unit/integration tests Change-Id: I1b025eac96458c0061e0883e1e4fd05484842ff2
50 lines
1.4 KiB
C++
50 lines
1.4 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(wvutil::FileSystem* file_system) {
|
|
file_system_ = file_system;
|
|
}
|
|
|
|
static int test_pass() { return default_config_->test_pass(); }
|
|
|
|
// Load a previously saved time. Returns 0 if the value does not exist or
|
|
// cannot be parsed.
|
|
int64_t LoadTime(const std::string& key);
|
|
// Save a time to persistent storage.
|
|
void SaveTime(const std::string& key, int64_t time);
|
|
|
|
protected:
|
|
void SetUp() override;
|
|
void TearDown() override;
|
|
|
|
// This is used to store each test's persistent data.
|
|
static wvutil::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_
|