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

Side by Side Diff: remoting/protocol/message_reader_unittest.cc

Issue 435823002: Revert "Update webrtc&libjingle 6774:6799." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 | « remoting/protocol/message_decoder.cc ('k') | remoting/protocol/message_serialization.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 #include "net/socket/socket.h" 15 #include "net/socket/socket.h"
16 #include "remoting/protocol/fake_session.h" 16 #include "remoting/protocol/fake_session.h"
17 #include "remoting/protocol/message_reader.h" 17 #include "remoting/protocol/message_reader.h"
18 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 #include "third_party/webrtc/base/byteorder.h" 20 #include "third_party/libjingle/source/talk/base/byteorder.h"
21 21
22 using testing::_; 22 using testing::_;
23 using testing::DoAll; 23 using testing::DoAll;
24 using testing::Mock; 24 using testing::Mock;
25 using testing::SaveArg; 25 using testing::SaveArg;
26 26
27 namespace remoting { 27 namespace remoting {
28 namespace protocol { 28 namespace protocol {
29 29
30 namespace { 30 namespace {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 STLDeleteElements(&messages_); 75 STLDeleteElements(&messages_);
76 } 76 }
77 77
78 void InitReader() { 78 void InitReader() {
79 reader_->Init(&socket_, base::Bind( 79 reader_->Init(&socket_, base::Bind(
80 &MessageReaderTest::OnMessage, base::Unretained(this))); 80 &MessageReaderTest::OnMessage, base::Unretained(this)));
81 } 81 }
82 82
83 void AddMessage(const std::string& message) { 83 void AddMessage(const std::string& message) {
84 std::string data = std::string(4, ' ') + message; 84 std::string data = std::string(4, ' ') + message;
85 rtc::SetBE32(const_cast<char*>(data.data()), message.size()); 85 talk_base::SetBE32(const_cast<char*>(data.data()), message.size());
86 86
87 socket_.AppendInputData(std::vector<char>(data.begin(), data.end())); 87 socket_.AppendInputData(std::vector<char>(data.begin(), data.end()));
88 } 88 }
89 89
90 bool CompareResult(CompoundBuffer* buffer, const std::string& expected) { 90 bool CompareResult(CompoundBuffer* buffer, const std::string& expected) {
91 std::string result(buffer->total_bytes(), ' '); 91 std::string result(buffer->total_bytes(), ' ');
92 buffer->CopyTo(const_cast<char*>(result.data()), result.size()); 92 buffer->CopyTo(const_cast<char*>(result.data()), result.size());
93 return result == expected; 93 return result == expected;
94 } 94 }
95 95
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 EXPECT_CALL(callback_, OnMessage(_)) 318 EXPECT_CALL(callback_, OnMessage(_))
319 .Times(1) 319 .Times(1)
320 .WillOnce(Invoke(this, &MessageReaderTest::DeleteReader)); 320 .WillOnce(Invoke(this, &MessageReaderTest::DeleteReader));
321 321
322 InitReader(); 322 InitReader();
323 base::RunLoop().RunUntilIdle(); 323 base::RunLoop().RunUntilIdle();
324 } 324 }
325 325
326 } // namespace protocol 326 } // namespace protocol
327 } // namespace remoting 327 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/message_decoder.cc ('k') | remoting/protocol/message_serialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698