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

Side by Side Diff: remoting/host/session_manager_unittest.cc

Issue 4255001: Revert 64672 - Cleanups in the video encoding decoding code. Reenable VP8.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/session_manager.cc ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/task.h" 6 #include "base/task.h"
7 #include "remoting/base/mock_objects.h" 7 #include "remoting/base/mock_objects.h"
8 #include "remoting/host/mock_objects.h" 8 #include "remoting/host/mock_objects.h"
9 #include "remoting/host/session_manager.h" 9 #include "remoting/host/session_manager.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 using ::testing::_; 13 using ::testing::_;
14 using ::testing::AtLeast; 14 using ::testing::AtLeast;
15 using ::testing::NotNull; 15 using ::testing::NotNull;
16 using ::testing::Return; 16 using ::testing::Return;
17 17
18 namespace remoting { 18 namespace remoting {
19 19
20 static const int kWidth = 640; 20 static const int kWidth = 640;
21 static const int kHeight = 480; 21 static const int kHeight = 480;
22 static const PixelFormat kFormat = PIXEL_FORMAT_RGB32; 22 static const PixelFormat kFormat = PixelFormatRgb32;
23 static const VideoPacketFormat::Encoding kEncoding = 23 static const UpdateStreamEncoding kEncoding = EncodingNone;
24 VideoPacketFormat::ENCODING_VERBATIM;
25 24
26 class SessionManagerTest : public testing::Test { 25 class SessionManagerTest : public testing::Test {
27 public: 26 public:
28 SessionManagerTest() { 27 SessionManagerTest() {
29 } 28 }
30 29
31 protected: 30 protected:
32 void Init() { 31 void Init() {
33 capturer_ = new MockCapturer(); 32 capturer_ = new MockCapturer();
34 encoder_ = new MockEncoder(); 33 encoder_ = new MockEncoder();
(...skipping 23 matching lines...) Expand all
58 InvalidRects temp_rects; 57 InvalidRects temp_rects;
59 std::set_union(dirty_rects.begin(), dirty_rects.end(), 58 std::set_union(dirty_rects.begin(), dirty_rects.end(),
60 rects.begin(), rects.end(), 59 rects.begin(), rects.end(),
61 std::inserter(temp_rects, temp_rects.begin())); 60 std::inserter(temp_rects, temp_rects.begin()));
62 dirty_rects.swap(temp_rects); 61 dirty_rects.swap(temp_rects);
63 arg0->Run(data); 62 arg0->Run(data);
64 delete arg0; 63 delete arg0;
65 } 64 }
66 65
67 ACTION_P(FinishEncode, msg) { 66 ACTION_P(FinishEncode, msg) {
68 arg2->Run(msg); 67 Encoder::EncodingState state = (Encoder::EncodingStarting |
68 Encoder::EncodingInProgress |
69 Encoder::EncodingEnded);
70 arg2->Run(msg, state);
69 delete arg2; 71 delete arg2;
70 } 72 }
71 73
72 // BUG 57351 74 // BUG 57351
73 TEST_F(SessionManagerTest, DISABLED_OneRecordCycle) { 75 TEST_F(SessionManagerTest, DISABLED_OneRecordCycle) {
74 Init(); 76 Init();
75 77
76 InvalidRects update_rects; 78 InvalidRects update_rects;
77 update_rects.insert(gfx::Rect(0, 0, 10, 10)); 79 update_rects.insert(gfx::Rect(0, 0, 10, 10));
78 DataPlanes planes; 80 DataPlanes planes;
(...skipping 10 matching lines...) Expand all
89 EXPECT_CALL(*capturer_, width()).WillRepeatedly(Return(kWidth)); 91 EXPECT_CALL(*capturer_, width()).WillRepeatedly(Return(kWidth));
90 EXPECT_CALL(*capturer_, height()).WillRepeatedly(Return(kHeight)); 92 EXPECT_CALL(*capturer_, height()).WillRepeatedly(Return(kHeight));
91 EXPECT_CALL(*client_, SendInitClientMessage(kWidth, kHeight)); 93 EXPECT_CALL(*client_, SendInitClientMessage(kWidth, kHeight));
92 record_->AddClient(client_); 94 record_->AddClient(client_);
93 95
94 // First the capturer is called. 96 // First the capturer is called.
95 EXPECT_CALL(*capturer_, CaptureInvalidRects(NotNull())) 97 EXPECT_CALL(*capturer_, CaptureInvalidRects(NotNull()))
96 .WillOnce(RunCallback(update_rects, data)); 98 .WillOnce(RunCallback(update_rects, data));
97 99
98 // Expect the encoder be called. 100 // Expect the encoder be called.
99 VideoPacket* packet = new VideoPacket(); 101 ChromotingHostMessage* msg = new ChromotingHostMessage();
100 EXPECT_CALL(*encoder_, Encode(data, false, NotNull())) 102 EXPECT_CALL(*encoder_, Encode(data, false, NotNull()))
101 .WillOnce(FinishEncode(packet)); 103 .WillOnce(FinishEncode(msg));
102 104
103 // Expect the client be notified. 105 // Expect the client be notified.
104 EXPECT_CALL(*client_, SendVideoPacket(_)); 106 EXPECT_CALL(*client_, SendBeginUpdateStreamMessage());
107 EXPECT_CALL(*client_, SendUpdateStreamPacketMessage(_));
108 EXPECT_CALL(*client_, SendEndUpdateStreamMessage());
105 EXPECT_CALL(*client_, GetPendingUpdateStreamMessages()) 109 EXPECT_CALL(*client_, GetPendingUpdateStreamMessages())
106 .Times(AtLeast(0)) 110 .Times(AtLeast(0))
107 .WillRepeatedly(Return(0)); 111 .WillRepeatedly(Return(0));
108 112
109 // Start the recording. 113 // Start the recording.
110 record_->Start(); 114 record_->Start();
111 115
112 // Make sure all tasks are completed. 116 // Make sure all tasks are completed.
113 message_loop_.RunAllPending(); 117 message_loop_.RunAllPending();
114 } 118 }
115 119
116 // TODO(hclam): Add test for double buffering. 120 // TODO(hclam): Add test for double buffering.
117 // TODO(hclam): Add test for multiple captures. 121 // TODO(hclam): Add test for multiple captures.
118 // TODO(hclam): Add test for interruption. 122 // TODO(hclam): Add test for interruption.
119 123
120 } // namespace remoting 124 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/session_manager.cc ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698