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

Unified Diff: remoting/host/screen_recorder_unittest.cc

Issue 8495035: Make ConnectionToClient and ClientSession not ref-counted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 1 month 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/host/screen_recorder.cc ('k') | remoting/protocol/connection_to_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/screen_recorder_unittest.cc
diff --git a/remoting/host/screen_recorder_unittest.cc b/remoting/host/screen_recorder_unittest.cc
index 86608ba44efdb955fda006f10134a793c77b37ec..d39e1b40def1dfe9e6e3744ba40255a885415e3c 100644
--- a/remoting/host/screen_recorder_unittest.cc
+++ b/remoting/host/screen_recorder_unittest.cc
@@ -22,6 +22,7 @@ using ::remoting::protocol::MockVideoStub;
using ::testing::_;
using ::testing::AtLeast;
+using ::testing::AnyNumber;
using ::testing::DeleteArg;
using ::testing::DoAll;
using ::testing::InSequence;
@@ -71,14 +72,16 @@ class ScreenRecorderTest : public testing::Test {
ScreenRecorderTest() {
}
- virtual void SetUp() {
+ virtual void SetUp() OVERRIDE {
// Capturer and Encoder are owned by ScreenRecorder.
encoder_ = new MockEncoder();
session_ = new MockSession();
EXPECT_CALL(*session_, SetStateChangeCallback(_));
- connection_ = new MockConnectionToClient(
- session_, &host_stub_, &event_executor_);
+ EXPECT_CALL(*session_, Close())
+ .Times(AnyNumber());
+ connection_.reset(new MockConnectionToClient(
+ session_, &host_stub_, &event_executor_));
connection_->SetEventHandler(&handler_);
record_ = new ScreenRecorder(
@@ -88,8 +91,7 @@ class ScreenRecorderTest : public testing::Test {
}
virtual void TearDown() OVERRIDE {
- record_ = NULL;
- connection_ = NULL;
+ connection_.reset();
// Run message loop before destroying because protocol::Session is
// destroyed asynchronously.
message_loop_.RunAllPending();
@@ -103,7 +105,7 @@ class ScreenRecorderTest : public testing::Test {
MockHostStub host_stub_;
MockEventExecutor event_executor_;
MockSession* session_; // Owned by |connection_|.
- scoped_refptr<MockConnectionToClient> connection_;
+ scoped_ptr<MockConnectionToClient> connection_;
// The following mock objects are owned by ScreenRecorder.
MockCapturer capturer_;
@@ -155,7 +157,7 @@ TEST_F(ScreenRecorderTest, StartAndStop) {
.RetiresOnSaturation();
// Add the mock client connection to the session.
- record_->AddConnection(connection_);
+ record_->AddConnection(connection_.get());
// Start the recording.
record_->Start();
« no previous file with comments | « remoting/host/screen_recorder.cc ('k') | remoting/protocol/connection_to_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698