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

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

Issue 2626423004: Remove all //blimp code. (Closed)
Patch Set: One last(?) `git merge` for good measure. Created 3 years, 11 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
« no previous file with comments | « blimp/common/create_blimp_message.cc ('k') | blimp/common/get_client_auth_token.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/memory/ptr_util.h"
6 #include "blimp/common/create_blimp_message.h"
7 #include "blimp/common/proto/blimp_message.pb.h"
8 #include "blimp/common/proto/compositor.pb.h"
9 #include "blimp/common/proto/input.pb.h"
10 #include "blimp/common/proto/navigation.pb.h"
11 #include "blimp/common/proto/render_widget.pb.h"
12 #include "blimp/common/proto/tab_control.pb.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14
15 namespace blimp {
16 namespace {
17
18 const int kTabId = 1234;
19
20 TEST(CreateBlimpMessageTest, CompositorMessage) {
21 CompositorMessage* details = nullptr;
22 std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details, kTabId);
23 EXPECT_NE(nullptr, details);
24 EXPECT_EQ(details, message->mutable_compositor());
25 EXPECT_EQ(kTabId, message->target_tab_id());
26 }
27
28 TEST(CreateBlimpMessageTest, TabControlMessage) {
29 TabControlMessage* details = nullptr;
30 std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
31 EXPECT_NE(nullptr, details);
32 EXPECT_EQ(details, message->mutable_tab_control());
33 }
34
35 TEST(CreateBlimpMessageTest, InputMessage) {
36 InputMessage* details = nullptr;
37 std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
38 EXPECT_NE(nullptr, details);
39 EXPECT_EQ(details, message->mutable_input());
40 }
41
42 TEST(CreateBlimpMessageTest, NavigationMessage) {
43 NavigationMessage* details = nullptr;
44 std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details, kTabId);
45 EXPECT_NE(nullptr, details);
46 EXPECT_EQ(details, message->mutable_navigation());
47 EXPECT_EQ(kTabId, message->target_tab_id());
48 }
49
50 TEST(CreateBlimpMessageTest, RenderWidgetMessage) {
51 RenderWidgetMessage* details = nullptr;
52 std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details, kTabId);
53 EXPECT_NE(nullptr, details);
54 EXPECT_EQ(details, message->mutable_render_widget());
55 EXPECT_EQ(kTabId, message->target_tab_id());
56 }
57
58 TEST(CreateBlimpMessageTest, SizeMessage) {
59 SizeMessage* details = nullptr;
60 std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
61 EXPECT_NE(nullptr, details);
62 EXPECT_EQ(TabControlMessage::kSize,
63 message->mutable_tab_control()->tab_control_case());
64 EXPECT_EQ(details, message->mutable_tab_control()->mutable_size());
65 }
66
67 TEST(CreateBlimpMessageTest, EngineSettingsMessage) {
68 EngineSettingsMessage* details;
69 std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
70 EXPECT_NE(nullptr, details);
71 EXPECT_EQ(details, message->mutable_settings()->mutable_engine_settings());
72 }
73
74 TEST(CreateBlimpMessageTest, StartConnectionMessage) {
75 const char* client_auth_token = "token";
76 const int protocol_version = 1;
77 std::unique_ptr<BlimpMessage> message =
78 CreateStartConnectionMessage(client_auth_token, protocol_version);
79 EXPECT_EQ(BlimpMessage::kProtocolControl, message->feature_case());
80 EXPECT_EQ(ProtocolControlMessage::kStartConnection,
81 message->protocol_control().connection_message_case());
82 EXPECT_EQ(client_auth_token,
83 message->protocol_control().start_connection().client_auth_token());
84 EXPECT_EQ(protocol_version,
85 message->protocol_control().start_connection().protocol_version());
86 }
87
88 TEST(CreateBlimpMessageTest, EndConnectionMessage) {
89 std::unique_ptr<BlimpMessage> message =
90 CreateEndConnectionMessage(EndConnectionMessage::PROTOCOL_MISMATCH);
91 EXPECT_EQ(BlimpMessage::kProtocolControl, message->feature_case());
92 EXPECT_EQ(ProtocolControlMessage::kEndConnection,
93 message->protocol_control().connection_message_case());
94 EXPECT_EQ(EndConnectionMessage::PROTOCOL_MISMATCH,
95 message->protocol_control().end_connection().reason());
96 }
97
98 TEST(CreateBlimpMessageTest, CheckpointAckMessage) {
99 const int64_t kTestCheckpointId = 1;
100
101 std::unique_ptr<BlimpMessage> message =
102 CreateCheckpointAckMessage(kTestCheckpointId);
103 EXPECT_EQ(BlimpMessage::kProtocolControl, message->feature_case());
104 EXPECT_EQ(ProtocolControlMessage::kCheckpointAck,
105 message->protocol_control().connection_message_case());
106 EXPECT_EQ(kTestCheckpointId,
107 message->protocol_control().checkpoint_ack().checkpoint_id());
108 }
109
110 TEST(CreateBlimpMessageTest, BlobChannelMessage) {
111 BlobChannelMessage* details;
112 std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
113 ASSERT_TRUE(message);
114 EXPECT_EQ(details, &message->blob_channel());
115 EXPECT_EQ(BlimpMessage::kBlobChannel, message->feature_case());
116 }
117
118 } // namespace
119 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/common/create_blimp_message.cc ('k') | blimp/common/get_client_auth_token.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698