| 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 | 4 |
| 5 /** | 5 /** |
| 6 * Test fixture for cards.js. | 6 * Test fixture for cards.js. |
| 7 * @constructor | 7 * @constructor |
| 8 * @extends {testing.Test} | 8 * @extends {testing.Test} |
| 9 */ | 9 */ |
| 10 function GoogleNowCardsUnitTest () { | 10 function GoogleNowCardsUnitTest () { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 testNotificationField: 'TEST NOTIFICATION VALUE B', | 37 testNotificationField: 'TEST NOTIFICATION VALUE B', |
| 38 priority: 2 | 38 priority: 2 |
| 39 }; | 39 }; |
| 40 var groupNameA = 'A'; | 40 var groupNameA = 'A'; |
| 41 var groupNameB = 'B'; | 41 var groupNameB = 'B'; |
| 42 var expectedAlarmId = 'card-TEST CARD ID'; | 42 var expectedAlarmId = 'card-TEST CARD ID'; |
| 43 var testActionUrlsA = {testField: 'TEST VALUE A'}; | 43 var testActionUrlsA = {testField: 'TEST VALUE A'}; |
| 44 var testActionUrlsB = {testField: 'TEST VALUE B'}; | 44 var testActionUrlsB = {testField: 'TEST VALUE B'}; |
| 45 var testDismissalA = {testDismissalField: 'TEST DISMISSAL VALUE A'}; | 45 var testDismissalA = {testDismissalField: 'TEST DISMISSAL VALUE A'}; |
| 46 var testDismissalB = {testDismissalField: 'TEST DISMISSAL VALUE B'}; | 46 var testDismissalB = {testDismissalField: 'TEST DISMISSAL VALUE B'}; |
| 47 var LOCATION_CARDS_LINK_THRESHOLD = 10; | 47 var EXPLANATORY_CARDS_LINK_THRESHOLD = 4; |
| 48 var localStorage = {locationCardsShown: 0}; | 48 var localStorage = {explanatoryCardsShown: 0}; |
| 49 var notificationUpdateSuccessful = true; | 49 var notificationUpdateSuccessful = true; |
| 50 var notificationUpdateFailed = false; | 50 var notificationUpdateFailed = false; |
| 51 | 51 |
| 52 function setUpCardManagerTest(fixture) { | 52 function setUpCardManagerTest(fixture) { |
| 53 fixture.makeAndRegisterMockApis([ | 53 fixture.makeAndRegisterMockApis([ |
| 54 'chrome.alarms.clear', | 54 'chrome.alarms.clear', |
| 55 'chrome.alarms.create', | 55 'chrome.alarms.create', |
| 56 'instrumented.notifications.clear', | 56 'instrumented.notifications.clear', |
| 57 'chrome.storage.local.set', | 57 'chrome.storage.local.set', |
| 58 'countLocationCard', | 58 'countExplanatoryCard', |
| 59 'instrumented.alarms.onAlarm.addListener', | 59 'instrumented.alarms.onAlarm.addListener', |
| 60 'instrumented.notifications.create', | 60 'instrumented.notifications.create', |
| 61 'instrumented.notifications.update', | 61 'instrumented.notifications.update', |
| 62 'instrumented.storage.local.get', | 62 'instrumented.storage.local.get', |
| 63 'tasks.add' | 63 'tasks.add' |
| 64 ]); | 64 ]); |
| 65 | 65 |
| 66 chrome.runtime = {}; // No error. | 66 chrome.runtime = {}; // No error. |
| 67 | 67 |
| 68 var onAlarmSavedArgs = new SaveMockArguments(); | 68 var onAlarmSavedArgs = new SaveMockArguments(); |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 timestamp: 300000, | 621 timestamp: 300000, |
| 622 combinedCard: [testUncombinedNotification] | 622 combinedCard: [testUncombinedNotification] |
| 623 } | 623 } |
| 624 }, | 624 }, |
| 625 notificationGroups: { | 625 notificationGroups: { |
| 626 }})); | 626 }})); |
| 627 | 627 |
| 628 // Call tested method. | 628 // Call tested method. |
| 629 test.alarmCallback({name: expectedAlarmId}); | 629 test.alarmCallback({name: expectedAlarmId}); |
| 630 }); | 630 }); |
| OLD | NEW |