src/base/profiler/module_cache_unittest.cc
TEST(ModuleCacheTest, RegisterAuxiliaryModuleProvider) {
  ModuleCache cache;
  EXPECT_EQ(nullptr, cache.GetModuleForAddress(1));

  MockModuleProvider auxiliary_provider;
  cache.RegisterAuxiliaryModuleProvider(&auxiliary_provider);
  auto* module = cache.GetModuleForAddress(1);
  EXPECT_NE(nullptr, module);
  EXPECT_EQ(1U, module->GetBaseAddress());
  cache.UnregisterAuxiliaryModuleProvider(&auxiliary_provider);

  // Even when unregistered, the module remains in the cache.
  EXPECT_EQ(module, cache.GetModuleForAddress(1));
}
// Check that auxiliary provider can inject new modules when registered.
Check that auxiliary provider can inject new modules when registered.
Check that auxiliary provider can inject new modules when registered .
TEST(ModuleCacheTest, RegisterAuxiliaryModuleProvider) {
  ModuleCache cache;
  EXPECT_EQ(nullptr, cache.GetModuleForAddress(1));
  MockModuleProvider auxiliary_provider;
  cache.RegisterAuxiliaryModuleProvider(&auxiliary_provider);
  auto* module = cache.GetModuleForAddress(1);
  EXPECT_NE(nullptr, module);
  EXPECT_EQ(1U, module->GetBaseAddress());
  cache.UnregisterAuxiliaryModuleProvider(&auxiliary_provider);
  EXPECT_EQ(module, cache.GetModuleForAddress(1));
}
TEST ( ModuleCacheTest , RegisterAuxiliaryModuleProvider ) { ModuleCache cache ; EXPECT_EQ ( nullptr , cache . GetModuleForAddress ( 1 ) ) ; MockModuleProvider auxiliary_provider ; cache . RegisterAuxiliaryModuleProvider ( & auxiliary_provider ) ; auto * module = cache . GetModuleForAddress ( 1 ) ; EXPECT_NE ( nullptr , module ) ; EXPECT_EQ ( 1U , module -> GetBaseAddress ( ) ) ; cache . UnregisterAuxiliaryModuleProvider ( & auxiliary_provider ) ; EXPECT_EQ ( module , cache . GetModuleForAddress ( 1 ) ) ; }
Check that auxiliary provider can inject new modules when registered.
Check that auxiliary provider can inject new modules when registered .
// Even when unregistered, the module remains in the cache.