56 lines
1.9 KiB
C++
56 lines
1.9 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// Copyright 2007 Google LLC.
|
|
//
|
|
// This software is licensed under the terms defined in the Widevine Master
|
|
// License Agreement. For a copy of this agreement, please contact
|
|
// widevine-licensing@google.com.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "util/proto_status.h"
|
|
|
|
#include "testing/gunit.h"
|
|
#include "protos/public/errors.pb.h"
|
|
|
|
namespace widevine {
|
|
namespace util {
|
|
|
|
TEST(StatusTest, PROVIDER_ID_MISMATCH_Status) {
|
|
Status status(ProtoEnumErrorSpace<Errors>::Get(), PROVIDER_ID_MISMATCH,
|
|
"provider_id_mismatch");
|
|
EXPECT_EQ("Errors::PROVIDER_ID_MISMATCH: provider_id_mismatch",
|
|
status.ToString());
|
|
}
|
|
|
|
TEST(StatusTest, PROVIDER_ID_MISMATCH_Status2) {
|
|
Status status(static_cast<error::StatusCode>(PROVIDER_ID_MISMATCH),
|
|
"provider_id_mismatch");
|
|
EXPECT_EQ("Errors::157: provider_id_mismatch", status.ToString());
|
|
}
|
|
|
|
TEST(StatusTest, Same) {
|
|
Status status1(ProtoEnumErrorSpace<Errors>::Get(), PROVIDER_ID_MISMATCH,
|
|
"provider_id_mismatch");
|
|
Status status2(ProtoEnumErrorSpace<Errors>::Get(), PROVIDER_ID_MISMATCH,
|
|
"this is a provider_id_mismatch error");
|
|
EXPECT_EQ(status1, status2);
|
|
}
|
|
|
|
TEST(StatusTest, NotTheSameStatus) {
|
|
Status status1(ProtoEnumErrorSpace<Errors>::Get(), PROVIDER_ID_MISMATCH,
|
|
"provider_id_mismatch");
|
|
Status status2(ProtoEnumErrorSpace<Errors>::Get(), MISSING_CLIENT_ID,
|
|
"missing client id");
|
|
EXPECT_NE(status1, status2);
|
|
}
|
|
|
|
TEST(StatusTest, NotTheSameErrorSpace) {
|
|
Status status1(ProtoEnumErrorSpace<Errors>::Get(), PROVIDER_ID_MISMATCH,
|
|
"provider_id_mismatch");
|
|
Status status2(static_cast<error::StatusCode>(PROVIDER_ID_MISMATCH),
|
|
"this is a provider_id_mismatch error");
|
|
EXPECT_NE(status1, status2);
|
|
}
|
|
|
|
} // namespace util
|
|
} // namespace widevine
|