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

Side by Side Diff: ipc/sync_socket_unittest.cc

Issue 1259823002: Remove Android filter file for ipc_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remaining tests Created 5 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 | « ipc/ipc_sync_channel_unittest.cc ('k') | no next file » | 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 "base/sync_socket.h" 5 #include "base/sync_socket.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <sstream> 8 #include <sstream>
9 #include <string> 9 #include <string>
10 10
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 base::SyncSocket* socket_; 160 base::SyncSocket* socket_;
161 IPC::Channel* chan_; 161 IPC::Channel* chan_;
162 162
163 DISALLOW_COPY_AND_ASSIGN(SyncSocketClientListener); 163 DISALLOW_COPY_AND_ASSIGN(SyncSocketClientListener);
164 }; 164 };
165 165
166 class SyncSocketTest : public IPCTestBase { 166 class SyncSocketTest : public IPCTestBase {
167 }; 167 };
168 168
169 TEST_F(SyncSocketTest, SanityTest) { 169 #if defined(OS_ANDROID)
170 #define MAYBE_SanityTest DISABLED_SanityTest
171 #else
172 #define MAYBE_SanityTest SanityTest
173 #endif
174 TEST_F(SyncSocketTest, MAYBE_SanityTest) {
170 Init("SyncSocketServerClient"); 175 Init("SyncSocketServerClient");
171 176
172 SyncSocketClientListener listener; 177 SyncSocketClientListener listener;
173 CreateChannel(&listener); 178 CreateChannel(&listener);
174 ASSERT_TRUE(StartClient()); 179 ASSERT_TRUE(StartClient());
175 // Create a pair of SyncSockets. 180 // Create a pair of SyncSockets.
176 base::SyncSocket pair[2]; 181 base::SyncSocket pair[2];
177 base::SyncSocket::CreatePair(&pair[0], &pair[1]); 182 base::SyncSocket::CreatePair(&pair[0], &pair[1]);
178 // Immediately after creation there should be no pending bytes. 183 // Immediately after creation there should be no pending bytes.
179 EXPECT_EQ(0U, pair[0].Peek()); 184 EXPECT_EQ(0U, pair[0].Peek());
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 246
242 // Now shut down the socket that the thread is issuing a blocking read on 247 // Now shut down the socket that the thread is issuing a blocking read on
243 // which should cause Receive to return with an error. 248 // which should cause Receive to return with an error.
244 pair[0].Shutdown(); 249 pair[0].Shutdown();
245 250
246 worker.Stop(); 251 worker.Stop();
247 252
248 EXPECT_EQ(0U, received); 253 EXPECT_EQ(0U, received);
249 } 254 }
250 255
256 #if defined(OS_ANDROID)
257 #define MAYBE_BlockingReceiveTest DISABLED_BlockingReceiveTest
258 #else
259 #define MAYBE_BlockingReceiveTest BlockingReceiveTest
260 #endif
251 // Tests that read is a blocking operation. 261 // Tests that read is a blocking operation.
252 TEST_F(SyncSocketTest, BlockingReceiveTest) { 262 TEST_F(SyncSocketTest, MAYBE_BlockingReceiveTest) {
253 base::CancelableSyncSocket pair[2]; 263 base::CancelableSyncSocket pair[2];
254 ASSERT_TRUE(base::CancelableSyncSocket::CreatePair(&pair[0], &pair[1])); 264 ASSERT_TRUE(base::CancelableSyncSocket::CreatePair(&pair[0], &pair[1]));
255 265
256 base::Thread worker("BlockingThread"); 266 base::Thread worker("BlockingThread");
257 worker.Start(); 267 worker.Start();
258 268
259 // Try to do a blocking read from one of the sockets on the worker thread. 269 // Try to do a blocking read from one of the sockets on the worker thread.
260 char buf[kHelloStringLength] = {0}; 270 char buf[kHelloStringLength] = {0};
261 size_t received = 1U; // Initialize to an unexpected value. 271 size_t received = 1U; // Initialize to an unexpected value.
262 worker.task_runner()->PostTask(FROM_HERE, 272 worker.task_runner()->PostTask(FROM_HERE,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 311
302 // Read from another socket to free some space for a new write. 312 // Read from another socket to free some space for a new write.
303 char hello[kHelloStringLength] = {0}; 313 char hello[kHelloStringLength] = {0};
304 pair[1].Receive(&hello[0], sizeof(hello)); 314 pair[1].Receive(&hello[0], sizeof(hello));
305 315
306 // Should be able to write more data to the buffer now. 316 // Should be able to write more data to the buffer now.
307 EXPECT_EQ(kHelloStringLength, pair[0].Send(kHelloString, kHelloStringLength)); 317 EXPECT_EQ(kHelloStringLength, pair[0].Send(kHelloString, kHelloStringLength));
308 } 318 }
309 319
310 } // namespace 320 } // namespace
OLDNEW
« no previous file with comments | « ipc/ipc_sync_channel_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698