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

Unified Diff: blimp/net/engine_authentication_handler_unittest.cc

Issue 1551583003: Implementation and fixes for Blimp client/engine E2E communication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dtrainor-linux-cl1528243002
Patch Set: Haibin feedback Created 4 years, 12 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: blimp/net/engine_authentication_handler_unittest.cc
diff --git a/blimp/net/engine_authentication_handler_unittest.cc b/blimp/net/engine_authentication_handler_unittest.cc
index 9a3f4ca6c0bf01b57caae1fd2593d00d91045267..416e5d14d7aade826bf234297758b46fa1e285b2 100644
--- a/blimp/net/engine_authentication_handler_unittest.cc
+++ b/blimp/net/engine_authentication_handler_unittest.cc
@@ -40,12 +40,10 @@ class EngineAuthenticationHandlerTest : public testing::Test {
protected:
void ExpectOnConnection() {
- EXPECT_CALL(*connection_, SetConnectionErrorObserver(_))
- .Times(2)
- .WillRepeatedly(SaveArg<0>(&error_observer_));
+ EXPECT_CALL(*connection_, AddConnectionErrorObserver(_))
+ .WillOnce(SaveArg<0>(&error_observer_));
EXPECT_CALL(*connection_, SetIncomingMessageProcessor(_))
- .Times(2)
- .WillRepeatedly(SaveArg<0>(&incoming_message_processor_));
+ .WillOnce(SaveArg<0>(&incoming_message_processor_));
}
scoped_refptr<base::TestMockTimeTaskRunner> runner_;
@@ -59,6 +57,7 @@ class EngineAuthenticationHandlerTest : public testing::Test {
TEST_F(EngineAuthenticationHandlerTest, AuthenticationSucceeds) {
ExpectOnConnection();
+ EXPECT_CALL(*connection_, RemoveConnectionErrorObserver(_));
EXPECT_CALL(connection_handler_, HandleConnectionPtr(Eq(connection_.get())));
auth_handler_->HandleConnection(std::move(connection_));
EXPECT_NE(nullptr, error_observer_);
@@ -69,8 +68,6 @@ TEST_F(EngineAuthenticationHandlerTest, AuthenticationSucceeds) {
incoming_message_processor_->ProcessMessage(std::move(blimp_message),
process_message_cb.callback());
EXPECT_EQ(net::OK, process_message_cb.WaitForResult());
- EXPECT_EQ(nullptr, error_observer_);
- EXPECT_EQ(nullptr, incoming_message_processor_);
}
TEST_F(EngineAuthenticationHandlerTest, WrongMessageReceived) {
@@ -83,8 +80,6 @@ TEST_F(EngineAuthenticationHandlerTest, WrongMessageReceived) {
incoming_message_processor_->ProcessMessage(std::move(blimp_message),
process_message_cb.callback());
EXPECT_EQ(net::OK, process_message_cb.WaitForResult());
- EXPECT_EQ(nullptr, error_observer_);
- EXPECT_EQ(nullptr, incoming_message_processor_);
}
TEST_F(EngineAuthenticationHandlerTest, ConnectionError) {
@@ -93,8 +88,6 @@ TEST_F(EngineAuthenticationHandlerTest, ConnectionError) {
EXPECT_NE(nullptr, error_observer_);
EXPECT_NE(nullptr, incoming_message_processor_);
error_observer_->OnConnectionError(net::ERR_FAILED);
- EXPECT_EQ(nullptr, error_observer_);
- EXPECT_EQ(nullptr, incoming_message_processor_);
}
TEST_F(EngineAuthenticationHandlerTest, Timeout) {
@@ -104,8 +97,6 @@ TEST_F(EngineAuthenticationHandlerTest, Timeout) {
EXPECT_NE(nullptr, incoming_message_processor_);
runner_->FastForwardBy(base::TimeDelta::FromSeconds(11));
- EXPECT_EQ(nullptr, error_observer_);
- EXPECT_EQ(nullptr, incoming_message_processor_);
}
TEST_F(EngineAuthenticationHandlerTest, AuthHandlerDeletedFirst) {

Powered by Google App Engine
This is Rietveld 408576698