OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 'use strict'; | 4 'use strict'; |
5 | 5 |
6 // Mock items. | 6 // Mock items. |
7 var background = null; | 7 var background = null; |
8 | 8 |
9 // Test target. | 9 // Test target. |
10 var handler = null; | 10 var handler = null; |
(...skipping 17 matching lines...) Expand all Loading... |
28 // Test for success copy. | 28 // Test for success copy. |
29 function testCopySuccess() { | 29 function testCopySuccess() { |
30 // Dispatch an event. | 30 // Dispatch an event. |
31 background.fileOperationManager.dispatchEvent({ | 31 background.fileOperationManager.dispatchEvent({ |
32 type: 'copy-progress', | 32 type: 'copy-progress', |
33 taskId: 'TASK_ID', | 33 taskId: 'TASK_ID', |
34 reason: 'BEGIN', | 34 reason: 'BEGIN', |
35 status: { | 35 status: { |
36 operationType: 'COPY', | 36 operationType: 'COPY', |
37 numRemainingItems: 1, | 37 numRemainingItems: 1, |
38 processingEntry: {name: 'sample.txt'}, | 38 processingEntryName: 'sample.txt', |
39 totalBytes: 200, | 39 totalBytes: 200, |
40 processedBytes: 0 | 40 processedBytes: 0 |
41 } | 41 } |
42 }); | 42 }); |
43 | 43 |
44 // Check the updated item. | 44 // Check the updated item. |
45 var item = background.progressCenter.items['TASK_ID']; | 45 var item = background.progressCenter.items['TASK_ID']; |
46 assertEquals(ProgressItemState.PROGRESSING, item.state); | 46 assertEquals(ProgressItemState.PROGRESSING, item.state); |
47 assertEquals('TASK_ID', item.id); | 47 assertEquals('TASK_ID', item.id); |
48 assertEquals('Copying sample.txt...', item.message); | 48 assertEquals('Copying sample.txt...', item.message); |
(...skipping 25 matching lines...) Expand all Loading... |
74 // Test for copy cancel. | 74 // Test for copy cancel. |
75 function testCopyCancel() { | 75 function testCopyCancel() { |
76 // Dispatch an event. | 76 // Dispatch an event. |
77 background.fileOperationManager.dispatchEvent({ | 77 background.fileOperationManager.dispatchEvent({ |
78 type: 'copy-progress', | 78 type: 'copy-progress', |
79 taskId: 'TASK_ID', | 79 taskId: 'TASK_ID', |
80 reason: 'BEGIN', | 80 reason: 'BEGIN', |
81 status: { | 81 status: { |
82 operationType: 'COPY', | 82 operationType: 'COPY', |
83 numRemainingItems: 1, | 83 numRemainingItems: 1, |
84 processingEntry: {name: 'sample.txt'}, | 84 processingEntryName: 'sample.txt', |
85 totalBytes: 200, | 85 totalBytes: 200, |
86 processedBytes: 0 | 86 processedBytes: 0 |
87 } | 87 } |
88 }); | 88 }); |
89 | 89 |
90 // Check the updated item. | 90 // Check the updated item. |
91 var item = background.progressCenter.items['TASK_ID']; | 91 var item = background.progressCenter.items['TASK_ID']; |
92 assertEquals(ProgressItemState.PROGRESSING, item.state); | 92 assertEquals(ProgressItemState.PROGRESSING, item.state); |
93 assertEquals('Copying sample.txt...', item.message); | 93 assertEquals('Copying sample.txt...', item.message); |
94 assertEquals('copy', item.type); | 94 assertEquals('copy', item.type); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 // Check the updated item. | 187 // Check the updated item. |
188 var item = background.progressCenter.items['TASK_ID']; | 188 var item = background.progressCenter.items['TASK_ID']; |
189 assertEquals(ProgressItemState.ERROR, item.state); | 189 assertEquals(ProgressItemState.ERROR, item.state); |
190 assertEquals('Copy unexpected error: Unexpected', item.message); | 190 assertEquals('Copy unexpected error: Unexpected', item.message); |
191 assertEquals('copy', item.type); | 191 assertEquals('copy', item.type); |
192 assertEquals(true, item.single); | 192 assertEquals(true, item.single); |
193 assertEquals(0, item.progressRateInPercent); | 193 assertEquals(0, item.progressRateInPercent); |
194 assertEquals(1, background.closeRequestCount); | 194 assertEquals(1, background.closeRequestCount); |
195 } | 195 } |
OLD | NEW |