| Index: chrome/browser/resources/google_now/cards_unittest.gtestjs | 
| diff --git a/chrome/browser/resources/google_now/cards_unittest.gtestjs b/chrome/browser/resources/google_now/cards_unittest.gtestjs | 
| index 44d82f3e12130e5865f79e8563b4edf3dfd16b88..2c80e4d8cb2b4c32e4d0e8202deb665899ce5bb0 100644 | 
| --- a/chrome/browser/resources/google_now/cards_unittest.gtestjs | 
| +++ b/chrome/browser/resources/google_now/cards_unittest.gtestjs | 
| @@ -76,279 +76,6 @@ TEST_F('GoogleNowCardsUnitTest', 'BuildCardManager', function() { | 
| assertEquals('function', typeof test.alarmCallback); | 
| }); | 
|  | 
| -TEST_F('GoogleNowCardsUnitTest', 'CreateCardEmptyTrigger', function() { | 
| -  // Creates a new card with empty trigger. | 
| - | 
| -  // Setup and expectations. | 
| -  var test = setUpCardManagerTest(this); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedHideAlarmId); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedShowAlarmId); | 
| -  var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); | 
| -  this.mockApis.expects(once()). | 
| -      instrumented_notifications_create( | 
| -          chromeNotificationsCreateSavedArgs.match(eq(testCardId)), | 
| -          chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), | 
| -          chromeNotificationsCreateSavedArgs.match(ANYTHING)). | 
| -      will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, testCardId)); | 
| - | 
| -  // Call tested method. | 
| -  var notificationData = test.cardSet.update(testCardId, { | 
| -    notification: testNotification, | 
| -    actionUrls: testActionUrls, | 
| -    dismissals: testDismissals, | 
| -    groupRank: testGroupRank, | 
| -    version: 0, | 
| -    trigger: {}}); | 
| - | 
| -  // Check the return value. | 
| -  assertEquals( | 
| -      JSON.stringify({ | 
| -        actionUrls: testActionUrls, | 
| -        cardCreateInfo: { | 
| -          notification: testNotification, | 
| -          hideTime: undefined, | 
| -          version: 0 | 
| -        }, | 
| -        dismissals: testDismissals | 
| -      }), | 
| -    JSON.stringify(notificationData)); | 
| -}); | 
| - | 
| -TEST_F('GoogleNowCardsUnitTest', 'CreateCardHideTime', function() { | 
| -  // Creates a new card with trigger specifying hide time. | 
| - | 
| -  // Setup and expectations. | 
| -  var test = setUpCardManagerTest(this); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedHideAlarmId); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedShowAlarmId); | 
| -  var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); | 
| -  this.mockApis.expects(once()). | 
| -      instrumented_notifications_create( | 
| -          chromeNotificationsCreateSavedArgs.match(eq(testCardId)), | 
| -          chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), | 
| -          chromeNotificationsCreateSavedArgs.match(ANYTHING)). | 
| -      will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, testCardId)); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_create(expectedHideAlarmId, eqJSON({when: 1313000})); | 
| - | 
| -  // Call tested method. | 
| -  var notificationData = test.cardSet.update(testCardId, { | 
| -    notification: testNotification, | 
| -    actionUrls: testActionUrls, | 
| -    dismissals: testDismissals, | 
| -    groupRank: testGroupRank, | 
| -    version: 0, | 
| -    trigger: {hideTime: 1313000}}); | 
| - | 
| -  // Check the return value. | 
| -  assertEquals( | 
| -      JSON.stringify({ | 
| -        actionUrls: testActionUrls, | 
| -        cardCreateInfo: { | 
| -          notification: testNotification, | 
| -          hideTime: 1313000, | 
| -          version: 0 | 
| -        }, | 
| -        dismissals: testDismissals | 
| -      }), | 
| -    JSON.stringify(notificationData)); | 
| -}); | 
| - | 
| -TEST_F('GoogleNowCardsUnitTest', 'CreateCardHideTimeExpired', function() { | 
| -  // Creates a new card with trigger specifying hide time which is in the past. | 
| - | 
| -  // Setup and expectations. | 
| -  var test = setUpCardManagerTest(this); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedHideAlarmId); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedShowAlarmId); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_create(expectedHideAlarmId, eqJSON({when: 299999})); | 
| - | 
| -  // Call tested method. | 
| -  var notificationData = test.cardSet.update(testCardId, { | 
| -    notification: testNotification, | 
| -    actionUrls: testActionUrls, | 
| -    dismissals: testDismissals, | 
| -    groupRank: testGroupRank, | 
| -    version: 0, | 
| -    trigger: {hideTime: 299999}}); | 
| - | 
| -  // Check the return value. | 
| -  assertEquals( | 
| -      JSON.stringify({ | 
| -        actionUrls: testActionUrls, | 
| -        cardCreateInfo: { | 
| -          notification: testNotification, | 
| -          hideTime: 299999, | 
| -          version: 0 | 
| -        }, | 
| -        dismissals: testDismissals | 
| -      }), | 
| -    JSON.stringify(notificationData)); | 
| -}); | 
| - | 
| -TEST_F('GoogleNowCardsUnitTest', 'UpdateCardSameVersion', function() { | 
| -  // Updates a card with another card with same version. | 
| - | 
| -  // Setup and expectations. | 
| -  var test = setUpCardManagerTest(this); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedHideAlarmId); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedShowAlarmId); | 
| -  var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); | 
| -  this.mockApis.expects(once()). | 
| -      instrumented_notifications_update( | 
| -          chromeNotificationsCreateSavedArgs.match(eq(testCardId)), | 
| -          chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), | 
| -          chromeNotificationsCreateSavedArgs.match(ANYTHING)). | 
| -      will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, true)); | 
| - | 
| -  // Call tested method. | 
| -  var notificationData = test.cardSet.update(testCardId, { | 
| -    notification: testNotification, | 
| -    actionUrls: testActionUrls, | 
| -    dismissals: testDismissals, | 
| -    groupRank: testGroupRank, | 
| -    version: 0, | 
| -    trigger: {}}, | 
| -      0); | 
| - | 
| -  // Check the return value. | 
| -  assertEquals( | 
| -      JSON.stringify({ | 
| -        actionUrls: testActionUrls, | 
| -        cardCreateInfo: { | 
| -          notification: testNotification, | 
| -          version: 0, | 
| -          previousVersion: 0 | 
| -        }, | 
| -        dismissals: testDismissals | 
| -      }), | 
| -    JSON.stringify(notificationData)); | 
| -}); | 
| - | 
| -TEST_F('GoogleNowCardsUnitTest', 'UpdateCardSameVersionHideTime', function() { | 
| -  // Updates a card with another card with same version and specifying hide | 
| -  // time. | 
| - | 
| -  // Setup and expectations. | 
| -  var test = setUpCardManagerTest(this); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedHideAlarmId); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedShowAlarmId); | 
| -  var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); | 
| -  this.mockApis.expects(once()). | 
| -      instrumented_notifications_update( | 
| -          chromeNotificationsCreateSavedArgs.match(eq(testCardId)), | 
| -          chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), | 
| -          chromeNotificationsCreateSavedArgs.match(ANYTHING)). | 
| -      will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, testCardId)); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_create(expectedHideAlarmId, eqJSON({when: 1313000})); | 
| - | 
| -  // Call tested method. | 
| -  test.cardSet.update(testCardId, { | 
| -                        notification: testNotification, | 
| -                        actionUrls: testActionUrls, | 
| -                        dismissals: testDismissals, | 
| -                        groupRank: testGroupRank, | 
| -                        version: 0, | 
| -                        trigger: {hideTime: 1313000}}, | 
| -                      0); | 
| -}); | 
| - | 
| -TEST_F('GoogleNowCardsUnitTest', 'UpdateCardDifferentVersion', function() { | 
| -  // Updates a card with another card with different version. | 
| - | 
| -  // Setup and expectations. | 
| -  var test = setUpCardManagerTest(this); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedHideAlarmId); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedShowAlarmId); | 
| -  this.mockApis.expects(once()). | 
| -      instrumented_notifications_create( | 
| -          testCardId, eqJSON(testNotification), ANYTHING); | 
| - | 
| -  // Call tested method. | 
| -  test.cardSet.update(testCardId, { | 
| -                        notification: testNotification, | 
| -                        actionUrls: testActionUrls, | 
| -                        dismissals: testDismissals, | 
| -                        groupRank: testGroupRank, | 
| -                        version: 0, | 
| -                        trigger: {}}, | 
| -                      1); | 
| -}); | 
| - | 
| -TEST_F('GoogleNowCardsUnitTest', 'CreateCardTriggerShowNow', function() { | 
| -  // Creates a new card with trigger that requires showing the card immediately. | 
| - | 
| -  // Setup and expectations. | 
| -  var test = setUpCardManagerTest(this); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedHideAlarmId); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedShowAlarmId); | 
| -  this.mockApis.expects(once()). | 
| -      instrumented_notifications_create( | 
| -          testCardId, eqJSON(testNotification), ANYTHING); | 
| - | 
| -  // Call tested method. | 
| -  test.cardSet.update(testCardId, { | 
| -    notification: testNotification, | 
| -    actionUrls: testActionUrls, | 
| -    dismissals: testDismissals, | 
| -    groupRank: testGroupRank, | 
| -    version: 0, | 
| -    trigger: {showTime: Date.now()}}); | 
| -}); | 
| - | 
| -TEST_F('GoogleNowCardsUnitTest', 'CreateCardTriggerShowLater', function() { | 
| -  // Creates a new card with trigger that requires showing the card later. | 
| -  // We are supposed to schedule an alarm to show the notification later. | 
| - | 
| -  // Setup and expectations. | 
| -  var test = setUpCardManagerTest(this); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedHideAlarmId); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_create(expectedShowAlarmId, eqJSON({when: 539000})); | 
| - | 
| -  // Call tested method. | 
| -  test.cardSet.update(testCardId, { | 
| -    notification: testNotification, | 
| -    actionUrls: testActionUrls, | 
| -    dismissals: testDismissals, | 
| -    groupRank: testGroupRank, | 
| -    version: 0, | 
| -    trigger: {showTime: 539000}}); | 
| -}); | 
| - | 
| -TEST_F('GoogleNowCardsUnitTest', 'ClearCard', function() { | 
| -  // Clears a card. | 
| - | 
| -  // Setup and expectations. | 
| -  var test = setUpCardManagerTest(this); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_notifications_clear(testCardId, ANYTHING); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedShowAlarmId); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedHideAlarmId); | 
| - | 
| -  // Call tested method. | 
| -  test.cardSet.clear(testCardId, false); | 
| -}); | 
| - | 
| TEST_F('GoogleNowCardsUnitTest', 'onAlarmUnrecognized', function() { | 
| // Tests onAlarm does nothing on an unrelated alarm. | 
| var test = setUpCardManagerTest(this); | 
| @@ -356,192 +83,3 @@ TEST_F('GoogleNowCardsUnitTest', 'onAlarmUnrecognized', function() { | 
| // Call tested method. | 
| test.alarmCallback({name: 'unrelated'}); | 
| }); | 
| - | 
| -TEST_F('GoogleNowCardsUnitTest', 'onAlarmShowNoData', function() { | 
| -  // Tests onAlarm for the 'show' alarm when there is no data for the card. | 
| -  var test = setUpCardManagerTest(this); | 
| - | 
| -  var tasksAddSavedArgs = new SaveMockArguments(); | 
| -  this.mockApis.expects(once()). | 
| -      tasks_add( | 
| -          tasksAddSavedArgs.match(eq(SHOW_CARD_TASK_NAME)), | 
| -          tasksAddSavedArgs.match(ANYTHING)). | 
| -      will(invokeCallback(tasksAddSavedArgs,1)); | 
| - | 
| -  var storageGetSavedArgs = new SaveMockArguments(); | 
| -  this.mockApis.expects(once()). | 
| -      instrumented_storage_local_get( | 
| -          storageGetSavedArgs.match(eq('notificationsData')), | 
| -          storageGetSavedArgs.match(ANYTHING)). | 
| -      will(invokeCallback(storageGetSavedArgs, 1, {})); | 
| - | 
| -  // Call tested method. | 
| -  test.alarmCallback({name: expectedShowAlarmId}); | 
| -}); | 
| - | 
| -TEST_F('GoogleNowCardsUnitTest', 'onAlarmShowHasDataCreate', function() { | 
| -  // Tests onAlarm for the 'show' alarm when there is data for the card. The | 
| -  // notification will be created because there is no previous version. | 
| -  var test = setUpCardManagerTest(this); | 
| - | 
| -  var tasksAddSavedArgs = new SaveMockArguments(); | 
| -  this.mockApis.expects(once()). | 
| -      tasks_add( | 
| -          tasksAddSavedArgs.match(eq(SHOW_CARD_TASK_NAME)), | 
| -          tasksAddSavedArgs.match(ANYTHING)). | 
| -      will(invokeCallback(tasksAddSavedArgs,1)); | 
| - | 
| -  var testCardCreateInfo = { | 
| -    notification: testNotification, | 
| -    hideTime: 1313000, | 
| -    version: 0}; | 
| - | 
| -  var storageGetSavedArgs = new SaveMockArguments(); | 
| -  this.mockApis.expects(once()). | 
| -      instrumented_storage_local_get( | 
| -          storageGetSavedArgs.match(eq('notificationsData')), | 
| -          storageGetSavedArgs.match(ANYTHING)). | 
| -      will(invokeCallback( | 
| -          storageGetSavedArgs, | 
| -          1, | 
| -          { | 
| -            notificationsData: { | 
| -              'TEST CARD ID': { | 
| -              actionUrls: testActionUrls, | 
| -              cardCreateInfo: testCardCreateInfo}}})); | 
| -  var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); | 
| -  this.mockApis.expects(once()). | 
| -      instrumented_notifications_create( | 
| -          chromeNotificationsCreateSavedArgs.match(eq(testCardId)), | 
| -          chromeNotificationsCreateSavedArgs.match(eqJSON(testNotification)), | 
| -          chromeNotificationsCreateSavedArgs.match(ANYTHING)). | 
| -      will(invokeCallback(chromeNotificationsCreateSavedArgs, 2, testCardId)); | 
| -  this.mockApis.expects(once()).countLocationCard(eqJSON(testCardCreateInfo)); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_create(expectedHideAlarmId, eqJSON({when: 1313000})); | 
| - | 
| -  // Call tested method. | 
| -  test.alarmCallback({name: expectedShowAlarmId}); | 
| -}); | 
| - | 
| -TEST_F('GoogleNowCardsUnitTest', 'onAlarmShowHasDataUpdate', function() { | 
| -  // Tests onAlarm for the 'show' alarm when there is data for the card. The | 
| -  // notification will be updated because previous version is same as current. | 
| -  var test = setUpCardManagerTest(this); | 
| - | 
| -  var tasksAddSavedArgs = new SaveMockArguments(); | 
| -  this.mockApis.expects(once()). | 
| -      tasks_add( | 
| -          tasksAddSavedArgs.match(eq(SHOW_CARD_TASK_NAME)), | 
| -          tasksAddSavedArgs.match(ANYTHING)). | 
| -      will(invokeCallback(tasksAddSavedArgs,1)); | 
| - | 
| -  var storageGetSavedArgs = new SaveMockArguments(); | 
| -  this.mockApis.expects(once()). | 
| -      instrumented_storage_local_get( | 
| -          storageGetSavedArgs.match(eq('notificationsData')), | 
| -          storageGetSavedArgs.match(ANYTHING)). | 
| -      will(invokeCallback( | 
| -          storageGetSavedArgs, | 
| -          1, | 
| -          { | 
| -            notificationsData: { | 
| -              'TEST CARD ID': { | 
| -              actionUrls: testActionUrls, | 
| -              cardCreateInfo: { | 
| -                notification: testNotification, | 
| -                hideTime: 1313000, | 
| -                version: 0, | 
| -                previousVersion:0}}}})); | 
| -  var chromeNotificationsCreateSavedArgs = new SaveMockArguments(); | 
| -  this.mockApis.expects(once()). | 
| -      instrumented_notifications_update( | 
| -          testCardId, eqJSON(testNotification), ANYTHING); | 
| - | 
| -  // Call tested method. | 
| -  test.alarmCallback({name: expectedShowAlarmId}); | 
| -}); | 
| - | 
| -TEST_F('GoogleNowCardsUnitTest', 'onAlarmHide', function() { | 
| -  // Tests onAlarm for the 'hide' alarm. | 
| -  var test = setUpCardManagerTest(this); | 
| -  var tasksAddSavedArgs = new SaveMockArguments(); | 
| -  this.mockApis.expects(once()). | 
| -      tasks_add( | 
| -          tasksAddSavedArgs.match(eq(CLEAR_CARD_TASK_NAME)), | 
| -          tasksAddSavedArgs.match(ANYTHING)). | 
| -      will(invokeCallback(tasksAddSavedArgs,1)); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_notifications_clear(testCardId, ANYTHING); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedShowAlarmId); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_alarms_clear(expectedHideAlarmId); | 
| -  var storageGetSavedArgs = new SaveMockArguments(); | 
| -  this.mockApis.expects(once()). | 
| -      instrumented_storage_local_get( | 
| -          storageGetSavedArgs.match( | 
| -              eqJSON(['notificationsData', 'notificationGroups'])), | 
| -          storageGetSavedArgs.match(ANYTHING)). | 
| -      will(invokeCallback( | 
| -          storageGetSavedArgs, | 
| -          1, | 
| -          { | 
| -            notificationsData: { | 
| -              'TEST CARD ID': {testField: 'TEST VALUE'}, | 
| -              'TEST CARD ID 1': {testField: 'TEST VALUE 1'} | 
| -            }, | 
| -            notificationGroups: { | 
| -              groupA: { | 
| -                cards: [ | 
| -                  { | 
| -                    chromeNotificationId: 'TEST CARD ID', | 
| -                    testField: 'TEST VALUE', | 
| -                  }, | 
| -                  { | 
| -                    chromeNotificationId: 'TEST CARD ID 1', | 
| -                    testField: 'TEST VALUE 1', | 
| -                  } | 
| -                ] | 
| -              }, | 
| -              groupB: { | 
| -                cards: [ | 
| -                  { | 
| -                    chromeNotificationId: 'TEST CARD ID 0', | 
| -                    testField: 'TEST VALUE 0', | 
| -                  }, | 
| -                  { | 
| -                    chromeNotificationId: 'TEST CARD ID', | 
| -                    testField: 'TEST VALUE', | 
| -                  } | 
| -                ] | 
| -              } | 
| -            }})); | 
| -  this.mockApis.expects(once()). | 
| -      chrome_storage_local_set(eqJSON({ | 
| -        notificationsData: { | 
| -          'TEST CARD ID 1': {testField: 'TEST VALUE 1'} | 
| -        }, | 
| -        notificationGroups: { | 
| -          groupA: { | 
| -            cards: [ | 
| -              { | 
| -                chromeNotificationId: 'TEST CARD ID 1', | 
| -                testField: 'TEST VALUE 1', | 
| -              } | 
| -            ] | 
| -          }, | 
| -          groupB: { | 
| -            cards: [ | 
| -              { | 
| -                chromeNotificationId: 'TEST CARD ID 0', | 
| -                testField: 'TEST VALUE 0', | 
| -              } | 
| -            ] | 
| -          } | 
| -        } | 
| -      })); | 
| - | 
| -  // Call tested method. | 
| -  test.alarmCallback({name: expectedHideAlarmId}); | 
| -}); | 
|  |