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

Side by Side Diff: blimp/net/blimp_message_pump_unittest.cc

Issue 1933053003: Used oneof in blimp_message.proto (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compared specific 'case' field into DCHECKs Created 4 years, 7 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 <stddef.h> 5 #include <stddef.h>
6 #include <string> 6 #include <string>
7 7
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "blimp/common/proto/blimp_message.pb.h" 9 #include "blimp/common/proto/blimp_message.pb.h"
10 #include "blimp/net/blimp_message_pump.h" 10 #include "blimp/net/blimp_message_pump.h"
(...skipping 13 matching lines...) Expand all
24 using testing::NotNull; 24 using testing::NotNull;
25 using testing::Return; 25 using testing::Return;
26 using testing::SaveArg; 26 using testing::SaveArg;
27 27
28 namespace blimp { 28 namespace blimp {
29 namespace { 29 namespace {
30 30
31 class BlimpMessagePumpTest : public testing::Test { 31 class BlimpMessagePumpTest : public testing::Test {
32 public: 32 public:
33 BlimpMessagePumpTest() 33 BlimpMessagePumpTest()
34 : message1_(new BlimpMessage), message2_(new BlimpMessage) { 34 : message1_(new BlimpMessage), message2_(new BlimpMessage) {
Kevin M 2016/05/16 22:58:02 Use CreateBlimpMessage() here to create valid inpu
shaktisahu 2016/05/17 01:21:32 Done.
35 message1_->set_type(BlimpMessage::INPUT); 35 message1_->mutable_input();
36 message2_->set_type(BlimpMessage::TAB_CONTROL); 36 message2_->mutable_tab_control();
37 message_pump_.reset(new BlimpMessagePump(&reader_)); 37 message_pump_.reset(new BlimpMessagePump(&reader_));
38 message_pump_->set_error_observer(&error_observer_); 38 message_pump_->set_error_observer(&error_observer_);
39 } 39 }
40 40
41 ~BlimpMessagePumpTest() override {} 41 ~BlimpMessagePumpTest() override {}
42 42
43 void NullMessageProcessor() { message_pump_->SetMessageProcessor(nullptr); } 43 void NullMessageProcessor() { message_pump_->SetMessageProcessor(nullptr); }
44 44
45 protected: 45 protected:
46 std::unique_ptr<BlimpMessage> message1_; 46 std::unique_ptr<BlimpMessage> message1_;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 message_pump_->SetMessageProcessor(&receiver_); 154 message_pump_->SetMessageProcessor(&receiver_);
155 ASSERT_FALSE(read_packet_cb.is_null()); 155 ASSERT_FALSE(read_packet_cb.is_null());
156 base::ResetAndReturn(&read_packet_cb).Run(message1_->ByteSize()); 156 base::ResetAndReturn(&read_packet_cb).Run(message1_->ByteSize());
157 process_msg_cb.Run(net::OK); 157 process_msg_cb.Run(net::OK);
158 // Running |process_msg_cb| should NOT trigger another ReadPacket call. 158 // Running |process_msg_cb| should NOT trigger another ReadPacket call.
159 } 159 }
160 160
161 } // namespace 161 } // namespace
162 162
163 } // namespace blimp 163 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698