def test_move_baselines_skip_git_commands(self): self.fs.write_text_file( '/mock-checkout/third_party/WebKit/LayoutTests/VirtualTestSuites', '[]') self.fs.write_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/another/test-expected.txt', 'result A') self.fs.write_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/another/test-expected.txt', 'result A') self.fs.write_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt', 'result B') baseline_optimizer = BaselineOptimizer( self.host, self.host.port_factory.get(), self.host.port_factory.all_port_names()) baseline_optimizer._move_baselines( 'another/test-expected.txt', { '/mock-checkout/third_party/WebKit/LayoutTests/platform/win': 'aaa', '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac': 'aaa', '/mock-checkout/third_party/WebKit/LayoutTests': 'bbb', }, { '/mock-checkout/third_party/WebKit/LayoutTests/platform/linux': 'bbb', '/mock-checkout/third_party/WebKit/LayoutTests': 'aaa', }) self.assertEqual( self.fs.read_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt' ), 'result A')
def test_move_baselines(self): host = MockHost() host.filesystem.write_text_file( '/mock-checkout/third_party/WebKit/LayoutTests/VirtualTestSuites', '[]') host.filesystem.write_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/another/test-expected.txt', 'result A') host.filesystem.write_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/another/test-expected.txt', 'result A') host.filesystem.write_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt', 'result B') baseline_optimizer = BaselineOptimizer( host, host.port_factory.get(), host.port_factory.all_port_names()) baseline_optimizer._move_baselines( 'another/test-expected.txt', { '/mock-checkout/third_party/WebKit/LayoutTests/platform/win': 'aaa', '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac': 'aaa', '/mock-checkout/third_party/WebKit/LayoutTests': 'bbb', }, { '/mock-checkout/third_party/WebKit/LayoutTests': 'aaa', }) self.assertEqual( host.filesystem.read_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt' ), 'result A')