Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Unified Diff: net/ssl/default_channel_id_store_unittest.cc

Issue 2109503009: Refactor net tests to use GMock matchers for checking net::Error results (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert changes to contents.txt files Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/ssl/default_channel_id_store_unittest.cc
diff --git a/net/ssl/default_channel_id_store_unittest.cc b/net/ssl/default_channel_id_store_unittest.cc
index 9a74ee9fadb0e074a8f1ea8068dfef99c16cb1b5..51f18435977d16b0d2829218cd951c77eccda37a 100644
--- a/net/ssl/default_channel_id_store_unittest.cc
+++ b/net/ssl/default_channel_id_store_unittest.cc
@@ -21,8 +21,13 @@
#include "crypto/ec_private_key.h"
#include "net/base/net_errors.h"
#include "net/test/channel_id_test_util.h"
+#include "net/test/gtest_util.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+using net::test::IsError;
+using net::test::IsOk;
+
namespace net {
namespace {
@@ -217,7 +222,7 @@ TEST(DefaultChannelIDStoreTest, TestAsyncGet) {
EXPECT_EQ(1, store.GetChannelIDCount());
EXPECT_FALSE(key);
EXPECT_TRUE(helper.called_);
- EXPECT_EQ(OK, helper.err_);
+ EXPECT_THAT(helper.err_, IsOk());
EXPECT_EQ("verisign.com", helper.server_identifier_);
EXPECT_TRUE(KeysEqual(expected_key.get(), helper.key_.get()));
}
@@ -375,11 +380,11 @@ TEST(DefaultChannelIDStoreTest, TestAsyncDelete) {
EXPECT_EQ(1, store.GetChannelIDCount());
EXPECT_FALSE(key);
EXPECT_TRUE(a_helper.called_);
- EXPECT_EQ(ERR_FILE_NOT_FOUND, a_helper.err_);
+ EXPECT_THAT(a_helper.err_, IsError(ERR_FILE_NOT_FOUND));
EXPECT_EQ("a.com", a_helper.server_identifier_);
EXPECT_FALSE(a_helper.key_);
EXPECT_TRUE(b_helper.called_);
- EXPECT_EQ(OK, b_helper.err_);
+ EXPECT_THAT(b_helper.err_, IsOk());
EXPECT_EQ("b.com", b_helper.server_identifier_);
EXPECT_TRUE(KeysEqual(expected_key.get(), b_helper.key_.get()));
}
« no previous file with comments | « net/ssl/channel_id_service_unittest.cc ('k') | net/test/embedded_test_server/embedded_test_server_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698