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

Side by Side Diff: blimp/common/create_blimp_message_unittest.cc

Issue 1876983002: Use Chromium BUILD to approximate Blimp protocol version, and check it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add disconnection message and unit-tests Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "blimp/common/create_blimp_message.h" 5 #include "blimp/common/create_blimp_message.h"
6 #include "blimp/common/proto/blimp_message.pb.h" 6 #include "blimp/common/proto/blimp_message.pb.h"
7 #include "blimp/common/proto/compositor.pb.h" 7 #include "blimp/common/proto/compositor.pb.h"
8 #include "blimp/common/proto/input.pb.h" 8 #include "blimp/common/proto/input.pb.h"
9 #include "blimp/common/proto/navigation.pb.h" 9 #include "blimp/common/proto/navigation.pb.h"
10 #include "blimp/common/proto/render_widget.pb.h" 10 #include "blimp/common/proto/render_widget.pb.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 EXPECT_NE(nullptr, message); 84 EXPECT_NE(nullptr, message);
85 EXPECT_EQ(BlimpMessage::PROTOCOL_CONTROL, message->type()); 85 EXPECT_EQ(BlimpMessage::PROTOCOL_CONTROL, message->type());
86 EXPECT_EQ(ProtocolControlMessage::START_CONNECTION, 86 EXPECT_EQ(ProtocolControlMessage::START_CONNECTION,
87 message->protocol_control().type()); 87 message->protocol_control().type());
88 EXPECT_EQ(client_token, 88 EXPECT_EQ(client_token,
89 message->protocol_control().start_connection().client_token()); 89 message->protocol_control().start_connection().client_token());
90 EXPECT_EQ(protocol_version, 90 EXPECT_EQ(protocol_version,
91 message->protocol_control().start_connection().protocol_version()); 91 message->protocol_control().start_connection().protocol_version());
92 } 92 }
93 93
94 TEST(CreateBlimpMessageTest, EndConnectionMessage) {
95 std::unique_ptr<BlimpMessage> message =
96 CreateEndConnectionMessage(EndConnectionMessage::PROTOCOL_MISMATCH);
97 EXPECT_NE(nullptr, message);
Kevin M 2016/04/22 21:12:54 ASSERT_NE for null checks?
98 EXPECT_EQ(BlimpMessage::PROTOCOL_CONTROL, message->type());
99 EXPECT_EQ(ProtocolControlMessage::END_CONNECTION,
100 message->protocol_control().type());
101 EXPECT_EQ(EndConnectionMessage::PROTOCOL_MISMATCH,
102 message->protocol_control().end_connection().reason());
103 }
104
105 TEST(CreateBlimpMessageTest, CheckpointAckMessage) {
106 const int64_t kTestCheckpointId = 1;
107
108 std::unique_ptr<BlimpMessage> message =
109 CreateCheckpointAckMessage(kTestCheckpointId);
110 EXPECT_NE(nullptr, message);
111 EXPECT_EQ(BlimpMessage::PROTOCOL_CONTROL, message->type());
112 EXPECT_EQ(ProtocolControlMessage::CHECKPOINT_ACK,
113 message->protocol_control().type());
114 EXPECT_EQ(kTestCheckpointId,
115 message->protocol_control().checkpoint_ack().checkpoint_id());
116 }
117
94 } // namespace 118 } // namespace
95 } // namespace blimp 119 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698