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

Side by Side Diff: mojo/edk/embedder/platform_channel_pair_posix_unittest.cc

Issue 2322573002: misc files A-P: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Just rebased 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 unified diff | Download patch
« no previous file with comments | « ipc/ipc_channel_mojo_unittest.cc ('k') | mojo/edk/system/multiprocess_message_pipe_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/edk/embedder/platform_channel_pair.h" 5 #include "mojo/edk/embedder/platform_channel_pair.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <poll.h> 8 #include <poll.h>
9 #include <signal.h> 9 #include <signal.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 #endif 146 #endif
147 147
148 for (size_t i = 1; i < kNumHandlesToSend; i++) { 148 for (size_t i = 1; i < kNumHandlesToSend; i++) {
149 // Make |i| files, with the j-th file consisting of j copies of the digit 149 // Make |i| files, with the j-th file consisting of j copies of the digit
150 // |c|. 150 // |c|.
151 const char c = '0' + (i % 10); 151 const char c = '0' + (i % 10);
152 ScopedPlatformHandleVectorPtr platform_handles(new PlatformHandleVector); 152 ScopedPlatformHandleVectorPtr platform_handles(new PlatformHandleVector);
153 for (size_t j = 1; j <= i; j++) { 153 for (size_t j = 1; j <= i; j++) {
154 base::FilePath unused; 154 base::FilePath unused;
155 base::ScopedFILE fp( 155 base::ScopedFILE fp(
156 base::CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused)); 156 base::CreateAndOpenTemporaryFileInDir(temp_dir.GetPath(), &unused));
157 ASSERT_TRUE(fp); 157 ASSERT_TRUE(fp);
158 ASSERT_EQ(j, fwrite(std::string(j, c).data(), 1, j, fp.get())); 158 ASSERT_EQ(j, fwrite(std::string(j, c).data(), 1, j, fp.get()));
159 platform_handles->push_back( 159 platform_handles->push_back(
160 test::PlatformHandleFromFILE(std::move(fp)).release()); 160 test::PlatformHandleFromFILE(std::move(fp)).release());
161 ASSERT_TRUE(platform_handles->back().is_valid()); 161 ASSERT_TRUE(platform_handles->back().is_valid());
162 } 162 }
163 163
164 // Send the FDs (+ "hello"). 164 // Send the FDs (+ "hello").
165 struct iovec iov = {const_cast<char*>(kHello), sizeof(kHello)}; 165 struct iovec iov = {const_cast<char*>(kHello), sizeof(kHello)};
166 // We assume that the |sendmsg()| actually sends all the data. 166 // We assume that the |sendmsg()| actually sends all the data.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 PlatformChannelPair channel_pair; 203 PlatformChannelPair channel_pair;
204 ScopedPlatformHandle server_handle = channel_pair.PassServerHandle(); 204 ScopedPlatformHandle server_handle = channel_pair.PassServerHandle();
205 ScopedPlatformHandle client_handle = channel_pair.PassClientHandle(); 205 ScopedPlatformHandle client_handle = channel_pair.PassClientHandle();
206 206
207 const std::string file_contents("hello world"); 207 const std::string file_contents("hello world");
208 208
209 { 209 {
210 base::FilePath unused; 210 base::FilePath unused;
211 base::ScopedFILE fp( 211 base::ScopedFILE fp(
212 base::CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused)); 212 base::CreateAndOpenTemporaryFileInDir(temp_dir.GetPath(), &unused));
213 ASSERT_TRUE(fp); 213 ASSERT_TRUE(fp);
214 ASSERT_EQ(file_contents.size(), 214 ASSERT_EQ(file_contents.size(),
215 fwrite(file_contents.data(), 1, file_contents.size(), fp.get())); 215 fwrite(file_contents.data(), 1, file_contents.size(), fp.get()));
216 ScopedPlatformHandleVectorPtr platform_handles(new PlatformHandleVector); 216 ScopedPlatformHandleVectorPtr platform_handles(new PlatformHandleVector);
217 platform_handles->push_back( 217 platform_handles->push_back(
218 test::PlatformHandleFromFILE(std::move(fp)).release()); 218 test::PlatformHandleFromFILE(std::move(fp)).release());
219 ASSERT_TRUE(platform_handles->back().is_valid()); 219 ASSERT_TRUE(platform_handles->back().is_valid());
220 220
221 // Send the FD (+ "hello"). 221 // Send the FD (+ "hello").
222 struct iovec iov = {const_cast<char*>(kHello), sizeof(kHello)}; 222 struct iovec iov = {const_cast<char*>(kHello), sizeof(kHello)};
(...skipping 29 matching lines...) Expand all
252 char read_buf[100]; 252 char read_buf[100];
253 size_t bytes_read = fread(read_buf, 1, sizeof(read_buf), fp.get()); 253 size_t bytes_read = fread(read_buf, 1, sizeof(read_buf), fp.get());
254 EXPECT_EQ(file_contents.size(), bytes_read); 254 EXPECT_EQ(file_contents.size(), bytes_read);
255 EXPECT_EQ(file_contents, std::string(read_buf, bytes_read)); 255 EXPECT_EQ(file_contents, std::string(read_buf, bytes_read));
256 } 256 }
257 } 257 }
258 258
259 } // namespace 259 } // namespace
260 } // namespace edk 260 } // namespace edk
261 } // namespace mojo 261 } // namespace mojo
OLDNEW
« no previous file with comments | « ipc/ipc_channel_mojo_unittest.cc ('k') | mojo/edk/system/multiprocess_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698