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

Side by Side Diff: native_client_sdk/src/tests/nacl_io_test/tty_test.cc

Issue 262803014: Fix typo, "recieve" -> "receive", in NaCl/SDK code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « native_client_sdk/src/examples/tutorial/using_ppapi_simple/example.js ('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 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 <errno.h> 5 #include <errno.h>
6 #include <fcntl.h> 6 #include <fcntl.h>
7 #include <string.h> 7 #include <string.h>
8 #include <sys/ioctl.h> 8 #include <sys/ioctl.h>
9 #include <sys/select.h> 9 #include <sys/select.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 ASSERT_EQ(1, IsReadable(tty_fd)); 231 ASSERT_EQ(1, IsReadable(tty_fd));
232 232
233 // Read byte from tty. 233 // Read byte from tty.
234 char c; 234 char c;
235 ASSERT_EQ(1, ki_read(tty_fd, &c, 1)); 235 ASSERT_EQ(1, ki_read(tty_fd, &c, 1));
236 ASSERT_EQ('a', c); 236 ASSERT_EQ('a', c);
237 237
238 ASSERT_EQ(0, IsReadable(tty_fd)); 238 ASSERT_EQ(0, IsReadable(tty_fd));
239 } 239 }
240 240
241 static int g_recieved_signal; 241 static int g_received_signal;
242 242
243 static void sighandler(int sig) { g_recieved_signal = sig; } 243 static void sighandler(int sig) { g_received_signal = sig; }
244 244
245 TEST_F(TtyTest, WindowSize) { 245 TEST_F(TtyTest, WindowSize) {
246 // Get current window size 246 // Get current window size
247 struct winsize old_winsize = {0}; 247 struct winsize old_winsize = {0};
248 ASSERT_EQ(0, dev_tty_->Ioctl(TIOCGWINSZ, &old_winsize)); 248 ASSERT_EQ(0, dev_tty_->Ioctl(TIOCGWINSZ, &old_winsize));
249 249
250 // Install signal handler 250 // Install signal handler
251 sighandler_t new_handler = sighandler; 251 sighandler_t new_handler = sighandler;
252 sighandler_t old_handler = ki_signal(SIGWINCH, new_handler); 252 sighandler_t old_handler = ki_signal(SIGWINCH, new_handler);
253 ASSERT_NE(SIG_ERR, old_handler) << "signal return error: " << errno; 253 ASSERT_NE(SIG_ERR, old_handler) << "signal return error: " << errno;
254 254
255 g_recieved_signal = 0; 255 g_received_signal = 0;
256 256
257 // Set a new windows size 257 // Set a new windows size
258 struct winsize winsize; 258 struct winsize winsize;
259 winsize.ws_col = 100; 259 winsize.ws_col = 100;
260 winsize.ws_row = 200; 260 winsize.ws_row = 200;
261 EXPECT_EQ(0, dev_tty_->Ioctl(TIOCSWINSZ, &winsize)); 261 EXPECT_EQ(0, dev_tty_->Ioctl(TIOCSWINSZ, &winsize));
262 EXPECT_EQ(SIGWINCH, g_recieved_signal); 262 EXPECT_EQ(SIGWINCH, g_received_signal);
263 263
264 // Restore old signal handler 264 // Restore old signal handler
265 EXPECT_EQ(new_handler, ki_signal(SIGWINCH, old_handler)); 265 EXPECT_EQ(new_handler, ki_signal(SIGWINCH, old_handler));
266 266
267 // Verify new window size can be queried correctly. 267 // Verify new window size can be queried correctly.
268 winsize.ws_col = 0; 268 winsize.ws_col = 0;
269 winsize.ws_row = 0; 269 winsize.ws_row = 0;
270 EXPECT_EQ(0, dev_tty_->Ioctl(TIOCGWINSZ, &winsize)); 270 EXPECT_EQ(0, dev_tty_->Ioctl(TIOCGWINSZ, &winsize));
271 EXPECT_EQ(100, winsize.ws_col); 271 EXPECT_EQ(100, winsize.ws_col);
272 EXPECT_EQ(200, winsize.ws_row); 272 EXPECT_EQ(200, winsize.ws_row);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 struct timeval timeout; 348 struct timeval timeout;
349 timeout.tv_sec = 20; 349 timeout.tv_sec = 20;
350 timeout.tv_usec = 0; 350 timeout.tv_usec = 0;
351 351
352 int rtn = ki_select(tty_fd + 1, &readfds, NULL, &errorfds, &timeout); 352 int rtn = ki_select(tty_fd + 1, &readfds, NULL, &errorfds, &timeout);
353 pthread_join(resize_thread, NULL); 353 pthread_join(resize_thread, NULL);
354 354
355 ASSERT_EQ(1, rtn); 355 ASSERT_EQ(1, rtn);
356 } 356 }
357 } 357 }
OLDNEW
« no previous file with comments | « native_client_sdk/src/examples/tutorial/using_ppapi_simple/example.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698