OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 /** @fileoverview Suite of tests for extension-load-error. */ | 5 /** @fileoverview Suite of tests for extension-load-error. */ |
6 cr.define('extension_load_error_tests', function() { | 6 cr.define('extension_load_error_tests', function() { |
7 /** @enum {string} */ | 7 /** @enum {string} */ |
8 var TestNames = { | 8 var TestNames = { |
9 Interaction: 'Interaction', | 9 Interaction: 'Interaction', |
| 10 CodeSection: 'Code Section', |
10 }; | 11 }; |
11 | 12 |
12 /** | 13 /** |
13 * @implements {extensions.LoadErrorDelegate} | 14 * @implements {extensions.LoadErrorDelegate} |
14 * @extends {extension_test_util.ClickMock} | 15 * @extends {extension_test_util.ClickMock} |
15 * @constructor | 16 * @constructor |
16 */ | 17 */ |
17 function MockDelegate() {} | 18 function MockDelegate() {} |
18 | 19 |
19 MockDelegate.prototype = { | 20 MockDelegate.prototype = { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 expectTrue(isDialogVisible()); | 52 expectTrue(isDialogVisible()); |
52 | 53 |
53 mockDelegate.testClickingCalls( | 54 mockDelegate.testClickingCalls( |
54 loadError.$$('#retry'), 'retryLoadUnpacked', []); | 55 loadError.$$('#retry'), 'retryLoadUnpacked', []); |
55 expectFalse(isDialogVisible()); | 56 expectFalse(isDialogVisible()); |
56 | 57 |
57 loadError.show(); | 58 loadError.show(); |
58 MockInteractions.tap(loadError.$$('#dismiss')); | 59 MockInteractions.tap(loadError.$$('#dismiss')); |
59 expectFalse(isDialogVisible()); | 60 expectFalse(isDialogVisible()); |
60 }); | 61 }); |
| 62 |
| 63 test(assert(TestNames.CodeSection), function() { |
| 64 expectTrue(loadError.$.code.isEmpty()); |
| 65 var loadErrorProperties = { |
| 66 error: 'Some error', |
| 67 path: '/some/path', |
| 68 source: { |
| 69 beforeHighlight: 'before', |
| 70 highlight: 'highlight', |
| 71 afterHighlight: 'after', |
| 72 }, |
| 73 }; |
| 74 |
| 75 loadError.set('loadError', loadErrorProperties); |
| 76 expectFalse(loadError.$.code.isEmpty()); |
| 77 }); |
61 }); | 78 }); |
62 } | 79 } |
63 | 80 |
64 return { | 81 return { |
65 registerTests: registerTests, | 82 registerTests: registerTests, |
66 TestNames: TestNames, | 83 TestNames: TestNames, |
67 }; | 84 }; |
68 }); | 85 }); |
OLD | NEW |