vendor/chromium/base/util/memory_pressure/system_memory_pressure_evaluator_chromeos_unittest.cc
// Since it would be very hard to mock sysfs instead we will send in our own
// implementation of WaitForKernelNotification which instead will block on a
// pipe that we can trigger for the test to cause a mock kernel notification.
Since it would be very hard to mock sysfs instead we will send in our own
implementation of WaitForKernelNotification which instead will block on a
pipe that we can trigger for the test to cause a mock kernel notification.
Since it would be very hard to mock sysfs instead we will send in our own implementation of WaitForKernelNotification which instead will block on a pipe that we can trigger for the test to cause a mock kernel notification .
bool WaitForMockKernelNotification(int pipe_read_fd, int available_fd) {
  base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
                                                base::BlockingType::WILL_BLOCK);
  char buf = 0;
  int res = HANDLE_EINTR(read(pipe_read_fd, &buf, sizeof(buf)));
  return res > 0;
}
bool WaitForMockKernelNotification ( int pipe_read_fd , int available_fd ) { base :: ScopedBlockingCall scoped_blocking_call ( FROM_HERE , base :: BlockingType :: WILL_BLOCK ) ; char buf = 0 ; int res = HANDLE_EINTR ( read ( pipe_read_fd , & buf , sizeof ( buf ) ) ) ; return res > 0 ; }
Since it would be very hard to mock sysfs instead we will send in our own
implementation of WaitForKernelNotification which instead will block on a
pipe that we can trigger for the test to cause a mock kernel notification.
Since it would be very hard to mock sysfs instead we will send in our own implementation of WaitForKernelNotification which instead will block on a pipe that we can trigger for the test to cause a mock kernel notification .
// We just use a pipe to block our kernel notification thread until we have // a fake kernel notification. // Fail if we encounter any error.