Coverage for /Syzygy/refinery/symbols/symbol_provider_unittest.cc

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
0.0%0043.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    :  #include "syzygy/refinery/symbols/symbol_provider.h"
  16    :  
  17    :  #include <string>
  18    :  #include <vector>
  19    :  
  20    :  #include "base/files/file_path.h"
  21    :  #include "base/strings/utf_string_conversions.h"
  22    :  #include "gtest/gtest.h"
  23    :  #include "syzygy/core/unittest_util.h"
  24    :  #include "syzygy/pe/pe_file.h"
  25    :  #include "syzygy/refinery/core/address.h"
  26    :  #include "syzygy/refinery/process_state/process_state.h"
  27    :  #include "syzygy/refinery/process_state/process_state_util.h"
  28    :  #include "syzygy/refinery/types/type.h"
  29    :  #include "syzygy/refinery/types/type_repository.h"
  30    :  
  31  m :  namespace refinery {
  32    :  
  33  m :  namespace {
  34    :  
  35  m :  const Address kAddress = 0x0000CAFE;  // Fits 32-bit.
  36  m :  const Size kSize = 42U;
  37  m :  const uint32_t kChecksum = 11U;
  38  m :  const uint32_t kTimestamp = 22U;
  39    :  
  40  m :  }  // namespace
  41    :  
  42  m :  TEST(SymbolProviderTest, FindOrCreateTypeRepository) {
  43  m :    ProcessState process_state;
  44  m :    scoped_refptr<SymbolProvider> provider = new SymbolProvider();
  45    :  
  46    :    // Get the signature for test_types.dll.
  47  m :    const base::FilePath module_path(testing::GetSrcRelativePath(
  48  m :        L"syzygy\\refinery\\test_data\\test_types.dll"));
  49  m :    pe::PEFile pe_file;
  50  m :    ASSERT_TRUE(pe_file.Init(module_path));
  51  m :    pe::PEFile::Signature module_signature;
  52  m :    pe_file.GetSignature(&module_signature);
  53    :  
  54    :    // Successfully retrieve the repository.
  55  m :    scoped_refptr<TypeRepository> repository;
  56  m :    ASSERT_TRUE(
  57  m :        provider->FindOrCreateTypeRepository(module_signature, &repository));
  58  m :    ASSERT_TRUE(repository != nullptr);
  59  m :    ASSERT_GT(repository->size(), 0);
  60    :  
  61    :    // Ensure a second call retrieves the same object.
  62  m :    scoped_refptr<TypeRepository> second_repository;
  63  m :    ASSERT_TRUE(provider->FindOrCreateTypeRepository(module_signature,
  64  m :                                                     &second_repository));
  65  m :    ASSERT_EQ(repository.get(), second_repository.get());
  66  m :  }
  67    :  
  68  m :  TEST(SymbolProviderTest, FindOrCreateTypeNameIndex) {
  69  m :    ProcessState process_state;
  70  m :    scoped_refptr<SymbolProvider> provider = new SymbolProvider();
  71    :  
  72    :    // Get the signature for test_types.dll.
  73  m :    const base::FilePath module_path(testing::GetSrcRelativePath(
  74  m :        L"syzygy\\refinery\\test_data\\test_types.dll"));
  75  m :    pe::PEFile pe_file;
  76  m :    ASSERT_TRUE(pe_file.Init(module_path));
  77  m :    pe::PEFile::Signature module_signature;
  78  m :    pe_file.GetSignature(&module_signature);
  79    :  
  80    :    // Successfully retrieve the type name index.
  81  m :    scoped_refptr<TypeNameIndex> index;
  82  m :    ASSERT_TRUE(provider->FindOrCreateTypeNameIndex(module_signature, &index));
  83  m :    ASSERT_TRUE(index != nullptr);
  84  m :    std::vector<TypePtr> matching_types;
  85  m :    index->GetTypes(L"testing::TestSimpleUDT", &matching_types);
  86  m :    ASSERT_EQ(1, matching_types.size());
  87  m :  }
  88    :  
  89  m :  }  // namespace refinery

Coverage information generated Fri Jul 29 11:00:21 2016.