Coverage for /Syzygy/trace/common/unittest_util.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
0.0%0018.C++test

Line-by-line coverage:

   1    :  // Copyright 2012 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    :  // Declares a unittest helper class.
  16    :  
  17    :  #ifndef SYZYGY_TRACE_COMMON_UNITTEST_UTIL_H_
  18    :  #define SYZYGY_TRACE_COMMON_UNITTEST_UTIL_H_
  19    :  
  20    :  #include "base/files/file_path.h"
  21    :  #include "base/process/launch.h"
  22    :  #include "base/strings/string_piece.h"
  23    :  #include "gtest/gtest.h"
  24    :  #include "syzygy/trace/service/trace_file_writer.h"
  25    :  
  26  m :  namespace testing {
  27    :  
  28    :  // A utility class to manage an instance of the call trace service process
  29    :  // for tests.
  30  m :  class CallTraceService {
  31  m :   public:
  32  m :    CallTraceService();
  33  m :    ~CallTraceService();
  34    :  
  35    :    // Starts a call trace service instance with an
  36    :    // instance ID unique to this process.
  37    :    // @param trace_dir the directory where trace files will be created.
  38    :    // @note adds failures to the current tests on errors.
  39  m :    void Start(const base::FilePath& trace_dir);
  40    :  
  41    :    // Stops the service if it's running.
  42  m :    void Stop();
  43    :  
  44    :    // Publishes the instance ID in the process environment.
  45  m :    void SetEnvironment();
  46    :  
  47  m :   private:
  48  m :    std::string instance_id_;
  49    :  
  50    :    // The handle to the call trace service process.
  51  m :    base::ProcessHandle service_process_;
  52  m :  };
  53    :  
  54    :  // Given a raw record, wraps it with a RecordPrefix/TraceFileSegmentHeader/
  55    :  // RecordPrefix header before pushing it to the provided TraceFileWriter.
  56    :  // @param timestamp The timestamp to use for the record.
  57    :  // @param record_type The type of the record.
  58    :  // @param data The raw data.
  59    :  // @param length The length of the raw data.
  60    :  // @param writer The trace file writer to be written to.
  61  m :  void WriteRecord(uint64 timestamp,
  62  m :                   uint16 record_type,
  63  m :                   const void* data,
  64  m :                   size_t length,
  65  m :                   trace::service::TraceFileWriter* writer);
  66    :  
  67  m :  }  // namespace testing
  68    :  
  69    :  #endif  // SYZYGY_TRACE_COMMON_UNITTEST_UTIL_H_

Coverage information generated Thu Mar 26 16:15:41 2015.