Coverage for /Syzygy/kasko/testing/safe_pipe_reader.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%110.C++test

Line-by-line coverage:

   1    :  // Copyright 2015 Google Inc. All Rights Reserved.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  
  15    :  #ifndef SYZYGY_KASKO_TESTING_SAFE_PIPE_READER_H_
  16    :  #define SYZYGY_KASKO_TESTING_SAFE_PIPE_READER_H_
  17    :  
  18    :  #include <stdint.h>
  19    :  #include <windows.h>
  20    :  
  21    :  #include "base/macros.h"
  22    :  #include "base/threading/thread.h"
  23    :  #include "base/time/time.h"
  24    :  #include "base/win/scoped_handle.h"
  25    :  
  26    :  namespace kasko {
  27    :  namespace testing {
  28    :  
  29    :  // Opens an anonymous pipe that may be used for rudimentary IPC.
  30    :  class SafePipeReader {
  31    :   public:
  32    :    // Instantiates an anonymous pipe.
  33    :    SafePipeReader();
  34    :  
  35    :    ~SafePipeReader();
  36    :  
  37    :    // @returns an inheritable handle that may be used to write to the pipe.
  38  E :    HANDLE write_handle() { return write_handle_; }
  39    :  
  40    :    // Reads data from the anonymous pipe.
  41    :    // @param timeout The maximum duration to wait for the read operation to
  42    :    //     complete.
  43    :    // @param length The number of bytes to read.
  44    :    // @param buffer The destination to read into.
  45    :    // @returns true upon success.
  46    :    bool ReadData(base::TimeDelta timeout, size_t length, void* buffer);
  47    :  
  48    :    // @returns true if the instance is successfully initialized and ready for a
  49    :    //     call to ReadData.
  50    :    bool IsValid();
  51    :  
  52    :   private:
  53    :    base::Thread thread_;
  54    :    HANDLE read_handle_;
  55    :    HANDLE write_handle_;
  56    :  
  57    :    DISALLOW_COPY_AND_ASSIGN(SafePipeReader);
  58    :  };
  59    :  
  60    :  }  // namespace testing
  61    :  }  // namespace kasko
  62    :  
  63    :  #endif  // SYZYGY_KASKO_TESTING_SAFE_PIPE_READER_H_

Coverage information generated Thu Jan 14 17:40:38 2016.