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

Side by Side Diff: ipc/unix_domain_socket_util_unittest.cc

Issue 2118083002: ShellClient -> Service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mus2
Patch Set: . Created 4 years, 5 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/unix_domain_socket_util.cc ('k') | mash/app_driver/app_driver.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ipc/unix_domain_socket_util.h" 5 #include "ipc/unix_domain_socket_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <sys/socket.h> 8 #include <sys/socket.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 base::MessageLoopForIO::current()->WatchFileDescriptor( 65 base::MessageLoopForIO::current()->WatchFileDescriptor(
66 fd, true, base::MessageLoopForIO::WATCH_READ, watcher_.get(), this); 66 fd, true, base::MessageLoopForIO::WATCH_READ, watcher_.get(), this);
67 started_watching_event_.Signal(); 67 started_watching_event_.Signal();
68 } 68 }
69 void StopWatching(base::MessageLoopForIO::FileDescriptorWatcher* watcher) { 69 void StopWatching(base::MessageLoopForIO::FileDescriptorWatcher* watcher) {
70 watcher->StopWatchingFileDescriptor(); 70 watcher->StopWatchingFileDescriptor();
71 delete watcher; 71 delete watcher;
72 } 72 }
73 void OnFileCanReadWithoutBlocking(int fd) override { 73 void OnFileCanReadWithoutBlocking(int fd) override {
74 ASSERT_EQ(-1, server_fd_); 74 ASSERT_EQ(-1, server_fd_);
75 IPC::ServerAcceptConnection(fd, &server_fd_); 75 IPC::ServerOnConnect(fd, &server_fd_);
76 watcher_->StopWatchingFileDescriptor(); 76 watcher_->StopWatchingFileDescriptor();
77 accepted_event_.Signal(); 77 accepted_event_.Signal();
78 } 78 }
79 void OnFileCanWriteWithoutBlocking(int fd) override {} 79 void OnFileCanWriteWithoutBlocking(int fd) override {}
80 80
81 int server_fd_; 81 int server_fd_;
82 base::SingleThreadTaskRunner* target_thread_; 82 base::SingleThreadTaskRunner* target_thread_;
83 std::unique_ptr<base::MessageLoopForIO::FileDescriptorWatcher> watcher_; 83 std::unique_ptr<base::MessageLoopForIO::FileDescriptorWatcher> watcher_;
84 base::WaitableEvent started_watching_event_; 84 base::WaitableEvent started_watching_event_;
85 base::WaitableEvent accepted_event_; 85 base::WaitableEvent accepted_event_;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 HANDLE_EINTR(send(connection.client_fd(), buffer, buf_len, 0)); 172 HANDLE_EINTR(send(connection.client_fd(), buffer, buf_len, 0));
173 ASSERT_EQ(buf_len, sent_bytes); 173 ASSERT_EQ(buf_len, sent_bytes);
174 char recv_buf[sizeof(buffer)]; 174 char recv_buf[sizeof(buffer)];
175 size_t received_bytes = 175 size_t received_bytes =
176 HANDLE_EINTR(recv(connection.server_fd(), recv_buf, buf_len, 0)); 176 HANDLE_EINTR(recv(connection.server_fd(), recv_buf, buf_len, 0));
177 ASSERT_EQ(buf_len, received_bytes); 177 ASSERT_EQ(buf_len, received_bytes);
178 ASSERT_EQ(0, memcmp(recv_buf, buffer, buf_len)); 178 ASSERT_EQ(0, memcmp(recv_buf, buffer, buf_len));
179 } 179 }
180 180
181 } // namespace 181 } // namespace
OLDNEW
« no previous file with comments | « ipc/unix_domain_socket_util.cc ('k') | mash/app_driver/app_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698