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

Unified Diff: remoting/protocol/pepper_session_unittest.cc

Issue 9433027: Delete Session and SessionManager object synchronously. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 10 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
« no previous file with comments | « remoting/protocol/libjingle_transport_factory.cc ('k') | remoting/protocol/pepper_transport_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/pepper_session_unittest.cc
diff --git a/remoting/protocol/pepper_session_unittest.cc b/remoting/protocol/pepper_session_unittest.cc
index f889984257171831b277c417495348e0e365d475..edf6f759c39abb2dc0030238b86593bf8a156546 100644
--- a/remoting/protocol/pepper_session_unittest.cc
+++ b/remoting/protocol/pepper_session_unittest.cc
@@ -226,7 +226,7 @@ class PepperSessionTest : public testing::Test {
message_loop_.RunAllPending();
}
- void CreateChannel() {
+ void CreateChannel(bool expect_fail) {
client_session_->CreateStreamChannel(kChannelName, base::Bind(
&PepperSessionTest::OnClientChannelCreated, base::Unretained(this)));
host_session_->CreateStreamChannel(kChannelName, base::Bind(
@@ -238,6 +238,14 @@ class PepperSessionTest : public testing::Test {
EXPECT_CALL(host_channel_callback_, OnDone(_))
.WillOnce(QuitThreadOnCounter(&counter));
message_loop_.Run();
+
+ if (expect_fail) {
+ // At least one socket should fail to connect.
+ EXPECT_TRUE((!client_socket_.get()) || (!host_socket_.get()));
+ } else {
+ EXPECT_TRUE(client_socket_.get());
+ EXPECT_TRUE(host_socket_.get());
+ }
}
JingleThreadMessageLoop message_loop_;
@@ -323,13 +331,13 @@ TEST_F(PepperSessionTest, ConnectWithBadMultistepAuth) {
InitiateConnection(3, FakeAuthenticator::ACCEPT, true);
}
-// Verify that data can sent over stream channel.
+// Verify that data can be sent over stream channel.
TEST_F(PepperSessionTest, TestStreamChannel) {
CreateSessionManagers(1, FakeAuthenticator::ACCEPT);
ASSERT_NO_FATAL_FAILURE(
InitiateConnection(1, FakeAuthenticator::ACCEPT, false));
- ASSERT_NO_FATAL_FAILURE(CreateChannel());
+ ASSERT_NO_FATAL_FAILURE(CreateChannel(false));
StreamConnectionTester tester(host_socket_.get(), client_socket_.get(),
kMessageSize, kMessages);
@@ -344,7 +352,7 @@ TEST_F(PepperSessionTest, TestMultistepAuthStreamChannel) {
ASSERT_NO_FATAL_FAILURE(
InitiateConnection(3, FakeAuthenticator::ACCEPT, false));
- ASSERT_NO_FATAL_FAILURE(CreateChannel());
+ ASSERT_NO_FATAL_FAILURE(CreateChannel(false));
StreamConnectionTester tester(host_socket_.get(), client_socket_.get(),
kMessageSize, kMessages);
@@ -353,5 +361,14 @@ TEST_F(PepperSessionTest, TestMultistepAuthStreamChannel) {
tester.CheckResults();
}
+// Verify that we shutdown properly when channel authentication fails.
+TEST_F(PepperSessionTest, TestFailedChannelAuth) {
+ CreateSessionManagers(1, FakeAuthenticator::ACCEPT);
+ ASSERT_NO_FATAL_FAILURE(
+ InitiateConnection(1, FakeAuthenticator::REJECT_CHANNEL, false));
+
+ ASSERT_NO_FATAL_FAILURE(CreateChannel(true));
+}
+
} // namespace protocol
} // namespace remoting
« no previous file with comments | « remoting/protocol/libjingle_transport_factory.cc ('k') | remoting/protocol/pepper_transport_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698