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

Unified Diff: remoting/protocol/message_decoder_unittest.cc

Issue 2386733002: Remove stl_util's deletion functions from remoting/. (Closed)
Patch Set: fix Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/channel_multiplexer.cc ('k') | remoting/protocol/message_reader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/message_decoder_unittest.cc
diff --git a/remoting/protocol/message_decoder_unittest.cc b/remoting/protocol/message_decoder_unittest.cc
index 1c5f0731ed7446ce4de8708a21a5511cea8ee373..8bd9907d297002630ecffd4a1f2dcfac6ba3d578 100644
--- a/remoting/protocol/message_decoder_unittest.cc
+++ b/remoting/protocol/message_decoder_unittest.cc
@@ -10,7 +10,7 @@
#include <string>
#include "base/macros.h"
-#include "base/stl_util.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "remoting/proto/event.pb.h"
#include "remoting/proto/internal.pb.h"
@@ -64,7 +64,7 @@ void SimulateReadSequence(const int read_sequence[], int sequence_size) {
// Then feed the protocol decoder using the above generated data and the
// read pattern.
- std::list<EventMessage*> message_list;
+ std::list<std::unique_ptr<EventMessage>> message_list;
for (int pos = 0; pos < size;) {
SCOPED_TRACE("Input position: " + base::IntToString(pos));
@@ -80,10 +80,10 @@ void SimulateReadSequence(const int read_sequence[], int sequence_size) {
if (!message.get())
break;
- EventMessage* event = new EventMessage();
+ std::unique_ptr<EventMessage> event = base::MakeUnique<EventMessage>();
CompoundBufferInputStream stream(message.get());
ASSERT_TRUE(event->ParseFromZeroCopyStream(&stream));
- message_list.push_back(event);
+ message_list.push_back(std::move(event));
}
pos += read;
}
@@ -92,12 +92,9 @@ void SimulateReadSequence(const int read_sequence[], int sequence_size) {
EXPECT_EQ(10u, message_list.size());
unsigned int index = 0;
- for (std::list<EventMessage*>::iterator it =
- message_list.begin();
- it != message_list.end(); ++it) {
+ for (const auto& message : message_list) {
SCOPED_TRACE("Message " + base::UintToString(index));
- EventMessage* message = *it;
// Partial update stream.
EXPECT_TRUE(message->has_key_event());
@@ -107,7 +104,6 @@ void SimulateReadSequence(const int read_sequence[], int sequence_size) {
EXPECT_EQ((index % 2) != 0, message->key_event().pressed());
++index;
}
- base::STLDeleteElements(&message_list);
}
TEST(MessageDecoderTest, SmallReads) {
« no previous file with comments | « remoting/protocol/channel_multiplexer.cc ('k') | remoting/protocol/message_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698