Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import json | |
| 6 import copy | 5 import copy |
| 7 | 6 |
| 8 from webkitpy.common.host_mock import MockHost | 7 from webkitpy.common.host_mock import MockHost |
| 9 from webkitpy.common.net.buildbot import Build | 8 from webkitpy.common.net.buildbot import Build |
| 10 from webkitpy.common.net.buildbot_mock import MockBuildBot | 9 from webkitpy.common.net.buildbot_mock import MockBuildBot |
| 11 from webkitpy.common.net.layout_test_results import LayoutTestResult, LayoutTest Results | 10 from webkitpy.common.net.layout_test_results import LayoutTestResult, LayoutTest Results |
| 12 from webkitpy.common.net.web_mock import MockWeb | |
| 13 from webkitpy.common.system.log_testing import LoggingTestCase | 11 from webkitpy.common.system.log_testing import LoggingTestCase |
| 14 from webkitpy.layout_tests.builder_list import BuilderList | 12 from webkitpy.layout_tests.builder_list import BuilderList |
| 15 from webkitpy.w3c.wpt_expectations_updater import WPTExpectationsUpdater, MARKER _COMMENT | 13 from webkitpy.w3c.wpt_expectations_updater import WPTExpectationsUpdater, MARKER _COMMENT |
| 16 | 14 |
| 17 | 15 |
| 18 class WPTExpectationsUpdaterTest(LoggingTestCase): | 16 class WPTExpectationsUpdaterTest(LoggingTestCase): |
| 19 | 17 |
| 20 def mock_host(self): | 18 def mock_host(self): |
| 21 super(WPTExpectationsUpdaterTest, self).setUp() | 19 super(WPTExpectationsUpdaterTest, self).setUp() |
| 22 host = MockHost() | 20 host = MockHost() |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 # since that should be covered by downloading a new baseline. | 411 # since that should be covered by downloading a new baseline. |
| 414 self.assertEqual(modified_test_results, { | 412 self.assertEqual(modified_test_results, { |
| 415 'external/fake/test/path.html': { | 413 'external/fake/test/path.html': { |
| 416 'two': {'expected': 'SLOW', 'actual': 'TIMEOUT'}, | 414 'two': {'expected': 'SLOW', 'actual': 'TIMEOUT'}, |
| 417 }, | 415 }, |
| 418 }) | 416 }) |
| 419 # The original dict isn't modified. | 417 # The original dict isn't modified. |
| 420 self.assertEqual(test_results_dict, test_results_dict_copy) | 418 self.assertEqual(test_results_dict, test_results_dict_copy) |
| 421 | 419 |
| 422 def test_run_no_issue_number(self): | 420 def test_run_no_issue_number(self): |
| 421 # TODO(qyearsley): For testing: Consider making a MockGitCL class | |
| 422 # and use that class to set fake return values when using git cl. | |
| 423 updater = WPTExpectationsUpdater(self.mock_host()) | 423 updater = WPTExpectationsUpdater(self.mock_host()) |
| 424 updater.get_issue_number = lambda: 'None' | 424 updater.get_issue_number = lambda: 'None' |
| 425 self.assertEqual(1, updater.run(args=[])) | 425 self.assertEqual(1, updater.run(args=[])) |
| 426 self.assertLog(['ERROR: No issue on current branch.\n']) | 426 self.assertLog(['ERROR: No issue on current branch.\n']) |
| 427 | 427 |
| 428 def test_run_no_try_results(self): | 428 def test_run_no_try_results(self): |
| 429 host = self.mock_host() | 429 host = self.mock_host() |
| 430 host.web = MockWeb(urls={ | |
| 431 'https://codereview.chromium.org/api/11112222': json.dumps({ | |
| 432 'patchsets': [1], | |
| 433 }), | |
| 434 'https://codereview.chromium.org/api/11112222/1': json.dumps({ | |
| 435 'try_job_results': [] | |
| 436 }) | |
| 437 }) | |
| 438 updater = WPTExpectationsUpdater(host) | 430 updater = WPTExpectationsUpdater(host) |
| 439 updater.get_issue_number = lambda: '11112222' | 431 updater.get_latest_try_jobs = lambda: [] |
|
qyearsley
2017/02/23 20:55:02
The main thing that I'm uncertain about in this CL
| |
| 440 self.assertEqual(1, updater.run(args=[])) | 432 self.assertEqual(1, updater.run(args=[])) |
| 441 self.assertEqual( | |
| 442 host.web.urls_fetched, | |
| 443 [ | |
| 444 'https://codereview.chromium.org/api/11112222', | |
| 445 'https://codereview.chromium.org/api/11112222/1' | |
| 446 ]) | |
| 447 self.assertLog(['ERROR: No try job information was collected.\n']) | 433 self.assertLog(['ERROR: No try job information was collected.\n']) |
| OLD | NEW |