aboutsummaryrefslogtreecommitdiff
path: root/cast/sender
diff options
context:
space:
mode:
authorJordan Bayles <jophba@chromium.org>2019-09-06 14:09:10 -0700
committerCommit Bot <commit-bot@chromium.org>2019-09-16 20:44:30 +0000
commitca5885ef241b7fa32e899f05709639fca93ccfa3 (patch)
treed8a809392d4aba077fdc9f0185351df65a5b5cec /cast/sender
parent235eb70c635e72018251b07ed7260924f8161c9f (diff)
downloadopenscreen-ca5885ef241b7fa32e899f05709639fca93ccfa3.tar.gz
Issue 72: Cleanups for ErrorOr
This patch removes ErrorOr's requirement that type shall be default constructible, using absl::optional. This patch also ensures support for and testing for primitive value types. Note: I investigating providing an operator Value() to replace MoveValue, however I believe that the resulting simplification is dangerous and not useful enough. An example: ErrorOr<UdpPacket> error_or_packet = foo(); UdpPacket packet = error_or_packet; It is not obvious that error_or_packet is invalid now, and we have moved its value into packet. Also, is the error still valid in error_or_packet? Should it be? Change-Id: I743c274fe4bcd466826d884b5d075ad2227d85c6 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/1802369 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com> Reviewed-by: Max Yakimakha <yakimakha@chromium.org>
Diffstat (limited to 'cast/sender')
-rw-r--r--cast/sender/channel/cast_auth_util_unittest.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/cast/sender/channel/cast_auth_util_unittest.cc b/cast/sender/channel/cast_auth_util_unittest.cc
index b8c94d53..10819362 100644
--- a/cast/sender/channel/cast_auth_util_unittest.cc
+++ b/cast/sender/channel/cast_auth_util_unittest.cc
@@ -242,9 +242,9 @@ TEST_F(CastAuthUtilTest, VerifyBadPeerCert) {
TEST_F(CastAuthUtilTest, VerifySenderNonceMatch) {
AuthContext context = AuthContext::Create();
- ErrorOr<CastDeviceCertPolicy> result =
+ const openscreen::Error result =
context.VerifySenderNonce(context.nonce(), true);
- EXPECT_TRUE(result);
+ EXPECT_TRUE(result.ok());
}
TEST_F(CastAuthUtilTest, VerifySenderNonceMismatch) {
@@ -282,9 +282,8 @@ TEST_F(CastAuthUtilTest, VerifyTLSCertificateSuccess) {
ASSERT_TRUE(ConvertTimeSeconds(not_before, &x));
std::chrono::seconds s(x);
- ErrorOr<CastDeviceCertPolicy> result =
- VerifyTLSCertificateValidity(tls_cert, s);
- EXPECT_TRUE(result);
+ const openscreen::Error result = VerifyTLSCertificateValidity(tls_cert, s);
+ EXPECT_TRUE(result.ok());
X509_free(tls_cert);
}