OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "remoting/protocol/message_decoder.h" | 5 #include "remoting/protocol/message_decoder.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 EventMessage* message = *it; | 100 EventMessage* message = *it; |
101 // Partial update stream. | 101 // Partial update stream. |
102 EXPECT_TRUE(message->has_key_event()); | 102 EXPECT_TRUE(message->has_key_event()); |
103 | 103 |
104 // TODO(sergeyu): Don't use index here. Instead store the expected values | 104 // TODO(sergeyu): Don't use index here. Instead store the expected values |
105 // in an array. | 105 // in an array. |
106 EXPECT_EQ(kTestKey + index, message->key_event().usb_keycode()); | 106 EXPECT_EQ(kTestKey + index, message->key_event().usb_keycode()); |
107 EXPECT_EQ((index % 2) != 0, message->key_event().pressed()); | 107 EXPECT_EQ((index % 2) != 0, message->key_event().pressed()); |
108 ++index; | 108 ++index; |
109 } | 109 } |
110 STLDeleteElements(&message_list); | 110 base::STLDeleteElements(&message_list); |
111 } | 111 } |
112 | 112 |
113 TEST(MessageDecoderTest, SmallReads) { | 113 TEST(MessageDecoderTest, SmallReads) { |
114 const int kReads[] = {1, 2, 3, 1}; | 114 const int kReads[] = {1, 2, 3, 1}; |
115 SimulateReadSequence(kReads, arraysize(kReads)); | 115 SimulateReadSequence(kReads, arraysize(kReads)); |
116 } | 116 } |
117 | 117 |
118 TEST(MessageDecoderTest, LargeReads) { | 118 TEST(MessageDecoderTest, LargeReads) { |
119 const int kReads[] = {50, 50, 5}; | 119 const int kReads[] = {50, 50, 5}; |
120 SimulateReadSequence(kReads, arraysize(kReads)); | 120 SimulateReadSequence(kReads, arraysize(kReads)); |
121 } | 121 } |
122 | 122 |
123 TEST(MessageDecoderTest, EmptyReads) { | 123 TEST(MessageDecoderTest, EmptyReads) { |
124 const int kReads[] = {4, 0, 50, 0}; | 124 const int kReads[] = {4, 0, 50, 0}; |
125 SimulateReadSequence(kReads, arraysize(kReads)); | 125 SimulateReadSequence(kReads, arraysize(kReads)); |
126 } | 126 } |
127 | 127 |
128 } // namespace protocol | 128 } // namespace protocol |
129 } // namespace remoting | 129 } // namespace remoting |
OLD | NEW |