From de8d11b8deab79108b4a3fc981dde7bcea0233a4 Mon Sep 17 00:00:00 2001 From: Fred Gylys-Colwell Date: Sun, 1 Jul 2018 20:25:53 -0700 Subject: [PATCH] Remove WrongMessageTest Merge from Widevine repo of http://go/wvgerrit/48841 This test is not providing value to the CDM, as it seems to exist primarily to validate server behavior. However, it is not doing what it says it is (the request is rejected because it is using unparseable garbage data, not because its key ID is unknown) and according to tinskip@, the behavior it claims to be testing is not valid. (The licensing service will not fail just because the key ID is unknown. Indeed, if the test data is fixed to use a valid payload with an unknown key ID, the test fails because the server does not.) Bug: 78640287 Test: CE CDM Unit Tests Test: Android Unit Tests Test: tested as part of http://go/ag/4674759 Change-Id: Idfcff15ab3d15fdfb6eb111b5dff68aa5a23fb37 --- .../cdm/core/test/cdm_engine_test.cpp | 11 ------- .../cdm/core/test/config_test_env.cpp | 12 ------- .../cdm/core/test/config_test_env.h | 2 -- .../cdm/test/cdm_extended_duration_test.cpp | 2 -- libwvdrmengine/cdm/test/cdm_feature_test.cpp | 2 -- .../cdm/test/request_license_test.cpp | 31 ------------------- 6 files changed, 60 deletions(-) diff --git a/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp b/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp index e175896c..06b6200c 100644 --- a/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp +++ b/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp @@ -48,7 +48,6 @@ std::string g_license_server; std::string g_provisioning_server; std::string g_provisioning_service_certificate; std::string g_license_service_certificate; -KeyId g_wrong_key_id; const std::string kCencMimeType = "video/mp4"; const std::string kWebmMimeType = "video/webm"; @@ -64,7 +63,6 @@ static void CommonSetup(ServerConfigurationId which, g_client_auth.assign(config.client_auth()); g_key_system.assign(config.key_system()); - g_wrong_key_id.assign(config.wrong_key_id()); g_license_server.assign(config.license_server()); g_key_id_pssh.assign(a2bs_hex(config.key_id())); g_provisioning_service_certificate.assign( @@ -571,15 +569,6 @@ TEST_F(WvCdmEngineTest, DISABLED_BaseWebmMessageTest) { GetKeyRequestResponse(g_license_server, g_client_auth); } -TEST_F(WvCdmEngineTest, WrongMessageTest) { - std::string wrong_message = a2bs_hex(g_wrong_key_id); - GenerateKeyRequest(wrong_message, kCencMimeType); - - // We should receive a response with no license, i.e. the extracted license - // response message should be empty. - ASSERT_EQ("", FailToGetKeyRequestResponse(g_license_server, g_client_auth)); -} - TEST_F(WvCdmEngineTest, NormalDecryptionIsoBmff) { GenerateKeyRequest(g_key_id_pssh, kCencMimeType); VerifyNewKeyResponse(g_license_server, g_client_auth); diff --git a/libwvdrmengine/cdm/core/test/config_test_env.cpp b/libwvdrmengine/cdm/core/test/config_test_env.cpp index a672c906..ff20e5ae 100644 --- a/libwvdrmengine/cdm/core/test/config_test_env.cpp +++ b/libwvdrmengine/cdm/core/test/config_test_env.cpp @@ -257,17 +257,6 @@ const std::string kGpClientOfflineRenewalQueryParameters = const std::string kGpClientOfflineReleaseQueryParameters = "&offline=true&release=true"; -// An invalid key id, expected to fail -const std::string kWrongKeyId = - "00000034" // blob size - "70737368" // "pssh" - "00000000" // flags - "edef8ba979d64acea3c827dcd51d21ed" // Widevine system id - "00000014" // pssh data size - // pssh data: - "0901121094889920e8d6520098577df8" - "f2dd5546"; - const ConfigTestEnv::LicenseServerConfiguration license_servers[] = { {kGooglePlayServer, kGpLicenseServer, "", kGpClientAuth, kGpKeyId, kGpOfflineKeyId, kCpProductionProvisioningServerUrl, ""}, @@ -324,7 +313,6 @@ void ConfigTestEnv::Init(ServerConfigurationId server_id) { a2bs_hex(license_servers[server_id].license_service_certificate); provisioning_service_certificate_ = a2bs_hex(license_servers[server_id].provisioning_service_certificate); - wrong_key_id_ = kWrongKeyId; } const CdmInitData ConfigTestEnv::GetInitData(ContentId content_id) { diff --git a/libwvdrmengine/cdm/core/test/config_test_env.h b/libwvdrmengine/cdm/core/test/config_test_env.h index 7c00cc1c..f785c29a 100644 --- a/libwvdrmengine/cdm/core/test/config_test_env.h +++ b/libwvdrmengine/cdm/core/test/config_test_env.h @@ -76,7 +76,6 @@ class ConfigTestEnv { const std::string& provisioning_service_certificate() const { return provisioning_service_certificate_; } - const KeyId& wrong_key_id() const { return wrong_key_id_; } static const CdmInitData GetInitData(ContentId content_id); static const std::string& GetLicenseServerUrl( @@ -103,7 +102,6 @@ class ConfigTestEnv { std::string provisioning_server_; std::string license_service_certificate_; std::string provisioning_service_certificate_; - KeyId wrong_key_id_; CORE_DISALLOW_COPY_AND_ASSIGN(ConfigTestEnv); }; diff --git a/libwvdrmengine/cdm/test/cdm_extended_duration_test.cpp b/libwvdrmengine/cdm/test/cdm_extended_duration_test.cpp index d2c7f1ca..286cd7dc 100644 --- a/libwvdrmengine/cdm/test/cdm_extended_duration_test.cpp +++ b/libwvdrmengine/cdm/test/cdm_extended_duration_test.cpp @@ -49,7 +49,6 @@ wvcdm::ConfigTestEnv* g_config = NULL; wvcdm::KeyId g_key_id; wvcdm::CdmKeySystem g_key_system; std::string g_license_server; -wvcdm::KeyId g_wrong_key_id; wvcdm::ServerConfigurationId g_license_server_id = wvcdm::kContentProtectionUatServer; @@ -1727,7 +1726,6 @@ int main(int argc, char** argv) { g_config = new wvcdm::ConfigTestEnv(g_license_server_id); g_client_auth.assign(g_config->client_auth()); g_key_system.assign(g_config->key_system()); - g_wrong_key_id.assign(g_config->wrong_key_id()); // The following variables are configurable through command line // options. If the command line arguments are absent, use the settings diff --git a/libwvdrmengine/cdm/test/cdm_feature_test.cpp b/libwvdrmengine/cdm/test/cdm_feature_test.cpp index bcb9d9a7..a5b0a697 100644 --- a/libwvdrmengine/cdm/test/cdm_feature_test.cpp +++ b/libwvdrmengine/cdm/test/cdm_feature_test.cpp @@ -63,7 +63,6 @@ wvcdm::ConfigTestEnv* g_config = NULL; wvcdm::KeyId g_key_id; wvcdm::CdmKeySystem g_key_system; std::string g_license_server; -wvcdm::KeyId g_wrong_key_id; wvcdm::ServerConfigurationId g_license_server_id = wvcdm::kContentProtectionUatServer; std::string g_service_certificate; @@ -702,7 +701,6 @@ int main(int argc, char** argv) { g_config = new wvcdm::ConfigTestEnv(g_license_server_id); g_client_auth.assign(g_config->client_auth()); g_key_system.assign(g_config->key_system()); - g_wrong_key_id.assign(g_config->wrong_key_id()); // The following variables are configurable through command line // options. If the command line arguments are absent, use the settings diff --git a/libwvdrmengine/cdm/test/request_license_test.cpp b/libwvdrmengine/cdm/test/request_license_test.cpp index 76dc3400..1f06d3c6 100644 --- a/libwvdrmengine/cdm/test/request_license_test.cpp +++ b/libwvdrmengine/cdm/test/request_license_test.cpp @@ -71,7 +71,6 @@ wvcdm::ConfigTestEnv* g_config = NULL; wvcdm::KeyId g_key_id; wvcdm::CdmKeySystem g_key_system; std::string g_license_server; -wvcdm::KeyId g_wrong_key_id; wvcdm::ServerConfigurationId g_server_configuration_id = wvcdm::kContentProtectionUatServer; std::string g_service_certificate; @@ -2100,35 +2099,6 @@ TEST_F(WvCdmRequestLicenseTest, BaseMessageTest) { decryptor_.CloseSession(session_id_); } -TEST_F(WvCdmRequestLicenseTest, WrongMessageTest) { - decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL, - &session_id_); - - std::string wrong_message = wvcdm::a2bs_hex(g_wrong_key_id); - GenerateKeyRequest(wrong_message, kLicenseTypeStreaming); - // We should receive a response with no license, i.e. the extracted license - // response message should be empty or an HTTP error - UrlRequest url_request(g_license_server + g_client_auth); - EXPECT_TRUE(url_request.is_connected()) << "Fail to connect to " - << g_license_server << g_client_auth; - url_request.PostRequest(key_msg_); - std::string message; - EXPECT_TRUE(url_request.GetResponse(&message)); - - int http_status_code = url_request.GetStatusCode(message); - std::string drm_msg; - if (kHttpOk == http_status_code) { - LicenseRequest lic_request; - lic_request.GetDrmMessage(message, drm_msg); - LOGV("HTTP response body: (%u bytes)", drm_msg.size()); - } - EXPECT_TRUE(drm_msg.empty()); - EXPECT_TRUE(kHttpOk == http_status_code || - kHttpBadRequest == http_status_code || - kHttpInternalServerError == http_status_code); - decryptor_.CloseSession(session_id_); -} - TEST_F(WvCdmRequestLicenseTest, AddStreamingKeyTest) { decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL, &session_id_); @@ -5135,7 +5105,6 @@ int main(int argc, char** argv) { g_config = new wvcdm::ConfigTestEnv(g_server_configuration_id); g_client_auth.assign(g_config->client_auth()); g_key_system.assign(g_config->key_system()); - g_wrong_key_id.assign(g_config->wrong_key_id()); // The following variables are configurable through command line // options. If the command line arguments are absent, use the settings