// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary // source code may only be used and distributed under the Widevine License // Agreement. #include "test_base.h" #include #include #include #include #include #include #include #include #include #include "cdm_engine.h" #include "clock.h" #include "crypto_session.h" #include "fake_provisioning_server.h" #include "file_store.h" #include "license.h" #include "log.h" #include "message_dumper.h" #include "oec_device_features.h" #include "oec_test_data.h" #include "platform.h" #include "properties.h" #include "provisioning_holder.h" #include "test_printers.h" #include "test_sleep.h" #include "url_request.h" using wvcdm::metrics::EngineMetrics; namespace wvcdm { namespace { void show_menu(const char* prog_name, const std::string& extra_help_text) { std::cout << std::endl; std::cout << "usage: " << prog_name << " [options]" << std::endl << std::endl; std::cout << " enclose multiple arguments in '' when using adb shell" << std::endl; std::cout << " e.g. adb shell '" << prog_name << " --server=\"url\"'" << std::endl; std::cout << " --verbose or -v" << std::endl; std::cout << " increase logging verbosity (may be repeated)" << std::endl << std::endl; std::cout << " --no_filter" << std::endl; std::cout << " Do not filter out inappropriate tests" << std::endl << std::endl; std::cout << " --cast" << std::endl; std::cout << " Run tests appropriate for a Cast Receiver" << std::endl << std::endl; std::cout << " --license_server_id=" << std::endl; std::cout << " specifies which default server settings to use: " << std::endl; std::cout << " gp for GooglePlay server" << std::endl; std::cout << " cp for Content Protection UAT server" << std::endl; std::cout << " st for Content Protection Staging server" << std::endl << std::endl; std::cout << " --keyid=" << std::endl; std::cout << " configure the key id or pssh, in hex format" << std::endl << std::endl; std::cout << " --service_certificate=" << std::endl; std::cout << " configure the signed license service certificate" << std::endl; std::cout << " Specify the SignedDeviceCertificate (from " << "device_certificate.proto) " << std::endl; std::cout << " in hex format." << std::endl; std::cout << " Due to the length of the argument use, " << std::endl; std::cout << " echo \"/system/bin/request_license_test -s \\\"" << "0ABF02...A29914\\\"\" \\" << std::endl; std::cout << " > run_request_license_test.sh" << std::endl; std::cout << " chmod +x run_request_license_test.sh" << std::endl; std::cout << " adb push run_request_license_test.sh /system/bin" << std::endl; std::cout << " adb shell sh /system/bin/run_request_license_test.sh" << std::endl << std::endl; std::cout << " --provisioning_certificate=" << std::endl; std::cout << " configure the signed provisioning service certificate" << std::endl << " in hex" << std::endl << std::endl; std::cout << " --license_server_url=" << std::endl; std::cout << " configure the license server url, please include http[s]" << " in the url" << std::endl << std::endl; std::cout << " --renewal_server_url=" << std::endl; std::cout << " configure the renewal server url, please include http[s] " "in the url" << std::endl << " If not set, this defaults to be the same url used by the " "license server." << std::endl << " Some tests, such as LicenseRenewalSpecifiedServer, will " "ignore this setting. " << std::endl << " See comments in the code for an explanation." << std::endl << std::endl; std::cout << " --provisioning_server_url=" << std::endl; std::cout << " configure the provisioning server url, please include http[s]" << " in the url" << std::endl << std::endl; std::cout << " --server_version=N" << std::endl; std::cout << " specify the server version. Tests that are not expected " << "to pass" << std::endl << " on this server version will be skipped." << std::endl << std::endl; std::cout << " --qa_provisioning" << std::endl; std::cout << " use the QA provisioning cert and QA test keybox" << std::endl << std::endl; std::cout << " --fake_sleep" << std::endl; std::cout << " Use a fake clock to sleep for duration tests. This cannot" << " be used with a real OEMCrypto." << std::endl << std::endl; std::cout << " --initial_time=