def testDependencyRoll(self): """Tests parsing ``regression_rolls`` from regression_range.""" dep_roll = DependencyRoll('src/', 'https://repo', 'rev1', 'rev6') regression_rolls = { dep_roll.path: dep_roll, 'src/dummy': DependencyRoll('src/dummy', 'https://r', 'rev2', 'rev4'), 'src/add': DependencyRoll('src/add', 'https://rr', None, 'rev5') } with mock.patch( 'libs.deps.chrome_dependency_fetcher.ChromeDependencyFetcher' '.GetDependencyRollsDict') as mock_get_dependency_rolls: mock_get_dependency_rolls.return_value = regression_rolls crash_data = ChromeCrashData( self.GetDummyChromeCrashData(), ChromeDependencyFetcher(self.GetMockRepoFactory())) crash_data._regression_range = ('rev1', 'rev6') chromium_dep = Dependency('src/', 'https://repo', 'rev1') crash_data._crashed_version_deps = { chromium_dep.path: chromium_dep, 'src/dummy': Dependency('src/dummy', 'https://r', 'rev2')} stack = CallStack(0, frame_list=[ StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', [5])]) stacktrace = Stacktrace([stack], stack) crash_data._stacktrace = stacktrace self.assertEqual(crash_data.dependency_rolls, {dep_roll.path: dep_roll})
def testDependencies(self): """Tests that ``dependencies`` returns filtered ``_CrashedVersionDeps``.""" crash_data = ChromeCrashData(self.GetDummyChromeCrashData(), None) chromium_dep = Dependency('src/', 'https://repo', 'rev1') crash_data._crashed_version_deps = { chromium_dep.path: chromium_dep, 'src/dummy': Dependency('src/dummy', 'https://r', 'rev2')} stack = CallStack(0, frame_list=[ StackFrame(0, 'src/', 'func', 'a.cc', 'src/a.cc', [5])]) stacktrace = Stacktrace([stack], stack) crash_data._stacktrace = stacktrace self.assertEqual(crash_data.dependencies, {chromium_dep.path: chromium_dep})
def testCrashedVersionDepsReturnsCache(self): """Tests that ``_CrashedVersionDeps`` returns cached value.""" crash_data = ChromeCrashData(self.GetDummyChromeCrashData(), None) crashed_version_deps = {'src/': Dependency('src/', 'https://repo', 'rev')} crash_data._crashed_version_deps = crashed_version_deps self.assertEqual(crash_data._CrashedVersionDeps(), crashed_version_deps)