Coverage for /Syzygy/pdb/unittest_util.cc

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%16160.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    :  #include "syzygy/pdb/unittest_util.h"
  16    :  
  17    :  #include "gtest/gtest.h"
  18    :  #include "syzygy/pdb/pdb_byte_stream.h"
  19    :  #include "syzygy/pdb/pdb_constants.h"
  20    :  #include "syzygy/pdb/pdb_util.h"
  21    :  
  22    :  namespace testing {
  23    :  
  24    :  const wchar_t kTestPdbFilePath[] =
  25    :      L"syzygy\\pdb\\test_data\\test_dll.pdb";
  26    :  
  27    :  const wchar_t kTestDllFilePath[] =
  28    :      L"syzygy\\pdb\\test_data\\test_dll.dll";
  29    :  
  30    :  const wchar_t kOmappedTestPdbFilePath[] =
  31    :      L"syzygy\\pdb\\test_data\\omapped_test_dll.pdb";
  32    :  
  33    :  const wchar_t kPdbStrPath[] =
  34    :      L"third_party\\debugging_tools\\files\\srcsrv\\pdbstr.exe";
  35    :  
  36    :  const wchar_t kValidPdbDbiStreamPath[] =
  37    :      L"syzygy\\pdb\\test_data\\valid_dbi.pdb_stream";
  38    :  
  39    :  const wchar_t kInvalidPdbDbiStreamPath[] =
  40    :      L"syzygy\\pdb\\test_data\\invalid_dbi.pdb_stream";
  41    :  
  42    :  const wchar_t kValidPdbSymbolRecordStreamPath[] =
  43    :      L"syzygy\\pdb\\test_data\\valid_sym_record.pdb_stream";
  44    :  
  45    :  const wchar_t kInvalidPdbSymbolRecordStreamPath[] =
  46    :      L"syzygy\\pdb\\test_data\\invalid_sym_record.pdb_stream";
  47    :  
  48    :  const wchar_t kValidPdbTypeInfoStreamPath[] =
  49    :      L"syzygy\\pdb\\test_data\\valid_type_info.pdb_stream";
  50    :  
  51    :  const wchar_t kInvalidHeaderPdbTypeInfoStreamPath[] =
  52    :      L"syzygy\\pdb\\test_data\\invalid_type_info_header_corrupted.pdb_stream";
  53    :  
  54    :  const wchar_t kInvalidDataPdbTypeInfoStreamPath[] =
  55    :      L"syzygy\\pdb\\test_data\\invalid_type_info_data_corrupted.pdb_stream";
  56    :  
  57  E :  scoped_refptr<pdb::PdbFileStream> GetStreamFromFile(base::FilePath file_path) {
  58  E :    int64 file_size = 0;
  59  E :    base::GetFileSize(file_path, &file_size);
  60  E :    size_t pages[] = {0};
  61    :  
  62    :    scoped_refptr<msf::RefCountedFILE> file =
  63  E :        new msf::RefCountedFILE(base::OpenFile(file_path, "rb"));
  64    :    scoped_refptr<pdb::PdbFileStream> stream(
  65  E :        new pdb::PdbFileStream(file.get(), file_size, pages, file_size));
  66    :  
  67  E :    return stream;
  68  E :  }
  69    :  
  70  E :  void InitMockPdbFile(pdb::PdbFile* pdb_file) {
  71  E :    scoped_refptr<pdb::PdbByteStream> stream(new pdb::PdbByteStream());
  72  E :    scoped_refptr<pdb::WritablePdbStream> writer(stream->GetWritableStream());
  73    :  
  74    :    pdb::PdbInfoHeader70 header = {
  75    :        pdb::kPdbCurrentVersion, 123456789, 1,
  76  E :        { 0xDEADBEEF, 0xCAFE, 0xBABE, { 0, 1, 2, 3, 4, 5, 6, 7 } } };
  77  E :    pdb::NameStreamMap name_stream_map;
  78    :    ASSERT_TRUE(
  79  E :        pdb::WriteHeaderInfoStream(header, name_stream_map, writer.get()));
  80    :  
  81  E :    pdb_file->SetStream(pdb::kPdbHeaderInfoStream, stream.get());
  82  E :  }
  83    :  
  84    :  }  // namespace testing

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