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

Side by Side Diff: remoting/base/typed_buffer_unittest.cc

Issue 1545723002: Use std::move() instead of .Pass() in remoting/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass_host
Patch Set: Created 5 years 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/base/rsa_key_pair.cc ('k') | remoting/base/url_request_context_getter.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 "remoting/base/typed_buffer.h" 5 #include "remoting/base/typed_buffer.h"
6
7 #include <utility>
8
6 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
7 10
8 namespace remoting { 11 namespace remoting {
9 12
10 namespace { 13 namespace {
11 14
12 struct Data { 15 struct Data {
13 // A variable size vector. 16 // A variable size vector.
14 int data[1]; 17 int data[1];
15 }; 18 };
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 TEST(TypedBufferTest, Pass) { 53 TEST(TypedBufferTest, Pass) {
51 TypedBuffer<Data> left; 54 TypedBuffer<Data> left;
52 TypedBuffer<Data> right(sizeof(int)); 55 TypedBuffer<Data> right(sizeof(int));
53 56
54 EXPECT_FALSE(left.get()); 57 EXPECT_FALSE(left.get());
55 EXPECT_EQ(left.length(), 0u); 58 EXPECT_EQ(left.length(), 0u);
56 EXPECT_TRUE(right.get()); 59 EXPECT_TRUE(right.get());
57 EXPECT_EQ(right.length(), sizeof(int)); 60 EXPECT_EQ(right.length(), sizeof(int));
58 61
59 Data* raw_ptr = right.get(); 62 Data* raw_ptr = right.get();
60 left = right.Pass(); 63 left = std::move(right);
61 64
62 // Verify that passing ownership transfers both the buffer pointer and its 65 // Verify that passing ownership transfers both the buffer pointer and its
63 // length. 66 // length.
64 EXPECT_EQ(left.get(), raw_ptr); 67 EXPECT_EQ(left.get(), raw_ptr);
65 EXPECT_EQ(left.length(), sizeof(int)); 68 EXPECT_EQ(left.length(), sizeof(int));
66 69
67 // Verify that the original object was cleared. 70 // Verify that the original object was cleared.
68 EXPECT_FALSE(right.get()); 71 EXPECT_FALSE(right.get());
69 EXPECT_EQ(right.length(), 0u); 72 EXPECT_EQ(right.length(), 0u);
70 } 73 }
(...skipping 21 matching lines...) Expand all
92 } 95 }
93 96
94 TEST(TypedBufferTest, GetAtOffset) { 97 TEST(TypedBufferTest, GetAtOffset) {
95 TypedBuffer<Data> buffer(sizeof(int) * 10); 98 TypedBuffer<Data> buffer(sizeof(int) * 10);
96 EXPECT_EQ(buffer.get(), buffer.GetAtOffset(0)); 99 EXPECT_EQ(buffer.get(), buffer.GetAtOffset(0));
97 EXPECT_EQ(reinterpret_cast<Data*>(&buffer->data[9]), 100 EXPECT_EQ(reinterpret_cast<Data*>(&buffer->data[9]),
98 buffer.GetAtOffset(sizeof(int) * 9)); 101 buffer.GetAtOffset(sizeof(int) * 9));
99 } 102 }
100 103
101 } // namespace remoting 104 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/rsa_key_pair.cc ('k') | remoting/base/url_request_context_getter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698