Index: chrome/test/functional/ntp.py |
diff --git a/chrome/test/functional/ntp.py b/chrome/test/functional/ntp.py |
index 234a1d8709bf7cf84672ea412a0665c17225d1eb..3086ee6df285fcb985784fa582f0bd0c09cb7622 100644 |
--- a/chrome/test/functional/ntp.py |
+++ b/chrome/test/functional/ntp.py |
@@ -529,203 +529,5 @@ class NTPTest(pyauto.PyUITest): |
self.assertTrue(actual_tab_url.startswith(expected_app_url_start), |
msg='The app was not launched in the new window.') |
- def _VerifyThumbnailOrMenuMode(self, actual_info, expected_info): |
- """Verifies that the expected thumbnail/menu info matches the actual info. |
- |
- This function verifies that the expected info is contained within the |
- actual info. It's ok for the expected info to be a subset of the actual |
- info. Only the specified expected info will be verified. |
- |
- Args: |
- actual_info: A dictionary representing the actual thumbnail or menu mode |
- information for all relevant sections of the NTP. |
- expected_info: A dictionary representing the expected thumbnail or menu |
- mode information for the relevant sections of the NTP. |
- """ |
- for sec_name in expected_info: |
- # Ensure the expected section name is present in the actual info. |
- self.assertTrue(sec_name in actual_info, |
- msg='The actual info is missing information for section ' |
- '"%s".' % (sec_name)) |
- # Ensure the expected section value matches what's in the actual info. |
- self.assertTrue(expected_info[sec_name] == actual_info[sec_name], |
- msg='For section "%s", expected value %s, but instead ' |
- 'was %s.' % (sec_name, expected_info[sec_name], |
- actual_info[sec_name])) |
- |
- def testGetThumbnailModeInNewProfile(self): |
- """Ensures only the most visited thumbnails are present in a new profile.""" |
- thumb_info = self.GetNTPThumbnailMode() |
- self._VerifyThumbnailOrMenuMode(thumb_info, |
- self._EXPECTED_DEFAULT_THUMB_INFO) |
- |
- def testSetThumbnailModeOn(self): |
- """Ensures that we can turn on thumbnail mode properly.""" |
- # Turn on thumbnail mode for the Apps section and verify that only this |
- # section is in thumbnail mode (since at most one section can be in |
- # thumbnail mode at any given time). |
- self.SetNTPThumbnailMode('apps', True) |
- thumb_info = self.GetNTPThumbnailMode() |
- expected_thumb_info = { |
- u'apps': True, |
- u'most_visited': False |
- } |
- self._VerifyThumbnailOrMenuMode(thumb_info, expected_thumb_info) |
- |
- # Now turn on thumbnail mode for the Most Visited section, and verify that |
- # it gets turned on while the Apps section has thumbnail mode turned off. |
- self.SetNTPThumbnailMode('most_visited', True) |
- thumb_info = self.GetNTPThumbnailMode() |
- expected_thumb_info = { |
- u'apps': False, |
- u'most_visited': True |
- } |
- self._VerifyThumbnailOrMenuMode(thumb_info, expected_thumb_info) |
- |
- # Now turn on thumbnail mode for both sections and verify that only the last |
- # one has thumbnail mode turned on. |
- self.SetNTPThumbnailMode('most_visited', True) |
- self.SetNTPThumbnailMode('apps', True) |
- thumb_info = self.GetNTPThumbnailMode() |
- expected_thumb_info = { |
- u'apps': True, |
- u'most_visited': False |
- } |
- self._VerifyThumbnailOrMenuMode(thumb_info, expected_thumb_info) |
- |
- def testSetThumbnailModeOff(self): |
- """Ensures that we can turn off thumbnail mode properly.""" |
- # First, ensure that only the Most Visited section is in thumbnail mode. |
- self.SetNTPThumbnailMode('most_visited', True) |
- thumb_info = self.GetNTPThumbnailMode() |
- expected_thumb_info = { |
- u'apps': False, |
- u'most_visited': True |
- } |
- self._VerifyThumbnailOrMenuMode(thumb_info, expected_thumb_info) |
- |
- # Turn off thumbnail mode for the Most Visited section and verify. |
- self.SetNTPThumbnailMode('most_visited', False) |
- thumb_info = self.GetNTPThumbnailMode() |
- expected_thumb_info = { |
- u'apps': False, |
- u'most_visited': False |
- } |
- self._VerifyThumbnailOrMenuMode(thumb_info, expected_thumb_info) |
- |
- # Turn off thumbnail mode for the Most Visited section and verify that it |
- # remains off. |
- self.SetNTPThumbnailMode('most_visited', False) |
- thumb_info = self.GetNTPThumbnailMode() |
- self._VerifyThumbnailOrMenuMode(thumb_info, expected_thumb_info) |
- |
- def testGetMenuModeInNewProfile(self): |
- """Ensures that all NTP sections are not in menu mode in a fresh profile.""" |
- menu_info = self.GetNTPMenuMode() |
- self._VerifyThumbnailOrMenuMode(menu_info, self._EXPECTED_DEFAULT_MENU_INFO) |
- |
- def testSetMenuModeOn(self): |
- """Ensures that we can turn on menu mode properly.""" |
- # Turn on menu mode for the Apps section and verify that it's turned on. |
- self.SetNTPMenuMode('apps', True) |
- menu_info = self.GetNTPMenuMode() |
- expected_menu_info = copy.copy(self._EXPECTED_DEFAULT_MENU_INFO) |
- expected_menu_info[u'apps'] = True |
- self._VerifyThumbnailOrMenuMode(menu_info, expected_menu_info) |
- |
- # Turn on menu mode for the remaining sections and verify that they're all |
- # on. |
- self.SetNTPMenuMode('most_visited', True) |
- self.SetNTPMenuMode('recently_closed', True) |
- menu_info = self.GetNTPMenuMode() |
- expected_menu_info[u'most_visited'] = True |
- expected_menu_info[u'recently_closed'] = True |
- self._VerifyThumbnailOrMenuMode(menu_info, expected_menu_info) |
- |
- def testSetMenuModeOff(self): |
- # Turn on menu mode for all sections, then turn it off for only the Apps |
- # section, then verify. |
- self.SetNTPMenuMode('apps', True) |
- self.SetNTPMenuMode('most_visited', True) |
- self.SetNTPMenuMode('recently_closed', True) |
- self.SetNTPMenuMode('apps', False) |
- menu_info = self.GetNTPMenuMode() |
- expected_menu_info = { |
- u'apps': False, |
- u'most_visited': True, |
- u'recently_closed': True |
- } |
- self._VerifyThumbnailOrMenuMode(menu_info, expected_menu_info) |
- |
- # Turn off menu mode for the remaining sections and verify. |
- self.SetNTPMenuMode('most_visited', False) |
- self.SetNTPMenuMode('recently_closed', False) |
- menu_info = self.GetNTPMenuMode() |
- expected_menu_info[u'most_visited'] = False |
- expected_menu_info[u'recently_closed'] = False |
- self._VerifyThumbnailOrMenuMode(menu_info, expected_menu_info) |
- |
- # Turn off menu mode for the Apps section again, and verify that it |
- # remains off. |
- self.SetNTPMenuMode('apps', False) |
- menu_info = self.GetNTPMenuMode() |
- self._VerifyThumbnailOrMenuMode(menu_info, expected_menu_info) |
- |
- def testSetThumbnailModeDoesNotAffectMenuModeAndViceVersa(self): |
- """Verifies that setting thumbnail/menu mode does not affect the other.""" |
- # Set thumbnail mode for the Apps section, set and unset menu mode for a |
- # few sections, and verify that all sections are in thumbnail/menu mode as |
- # expected. |
- self.SetNTPThumbnailMode('apps', True) |
- self.SetNTPMenuMode('apps', True) |
- self.SetNTPMenuMode('recently_closed', True) |
- self.SetNTPMenuMode('apps', False) |
- self.SetNTPMenuMode('most_visited', True) |
- self.SetNTPMenuMode('recently_closed', False) |
- self.SetNTPMenuMode('apps', True) |
- thumb_info = self.GetNTPThumbnailMode() |
- expected_thumb_info = { |
- u'apps': True, |
- u'most_visited': False |
- } |
- self._VerifyThumbnailOrMenuMode(thumb_info, expected_thumb_info) |
- menu_info = self.GetNTPMenuMode() |
- expected_menu_info = { |
- u'apps': True, |
- u'most_visited': True, |
- u'recently_closed': False |
- } |
- self._VerifyThumbnailOrMenuMode(menu_info, expected_menu_info) |
- |
- # Turn off menu mode for all sections. |
- self.SetNTPMenuMode('apps', False) |
- self.SetNTPMenuMode('most_visited', False) |
- self.SetNTPMenuMode('recently_closed', False) |
- |
- # Set menu mode for the Most Visited and Recently Closed sections, set and |
- # unset thumbnail mode for a few sections, and verify all is as expected. |
- self.SetNTPMenuMode('most_visited', True) |
- self.SetNTPMenuMode('recently_closed', True) |
- self.SetNTPThumbnailMode('apps', True) |
- self.SetNTPThumbnailMode('most_visited', True) |
- self.SetNTPThumbnailMode('apps', False) |
- self.SetNTPThumbnailMode('most_visited', False) |
- self.SetNTPThumbnailMode('apps', True) |
- self.SetNTPThumbnailMode('most_visited', True) |
- menu_info = self.GetNTPMenuMode() |
- expected_menu_info = { |
- u'apps': False, |
- u'most_visited': True, |
- u'recently_closed': True |
- } |
- self._VerifyThumbnailOrMenuMode(menu_info, expected_menu_info) |
- thumb_info = self.GetNTPThumbnailMode() |
- expected_thumb_info = { |
- u'apps': False, |
- u'most_visited': True |
- } |
- self._VerifyThumbnailOrMenuMode(thumb_info, expected_thumb_info) |
- |
- |
if __name__ == '__main__': |
pyauto_functional.Main() |