Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: chrome/test/functional/ntp.py

Issue 7548024: Refactor: Make PyAuto InstallExtension() take a string. Delete dead code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixup per kkania. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/functional/memory.py ('k') | chrome/test/functional/themes.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import os 6 import os
7 7
8 import pyauto_functional # Must be imported before pyauto 8 import pyauto_functional # Must be imported before pyauto
9 import pyauto 9 import pyauto
10 import test_utils 10 import test_utils
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 msg='For attribute "%s", expected value "%s", but got ' 363 msg='For attribute "%s", expected value "%s", but got '
364 '"%s".' % (attribute, expected_app[attribute], 364 '"%s".' % (attribute, expected_app[attribute],
365 actual_info[i][attribute])) 365 actual_info[i][attribute]))
366 366
367 def _InstallAndVerifySamplePackagedApp(self): 367 def _InstallAndVerifySamplePackagedApp(self):
368 """Installs a sample packaged app and verifies the install is successful. 368 """Installs a sample packaged app and verifies the install is successful.
369 369
370 Returns: 370 Returns:
371 The string ID of the installed app. 371 The string ID of the installed app.
372 """ 372 """
373 app_crx_file = pyauto.FilePath( 373 app_crx_file = os.path.abspath(os.path.join(
374 os.path.abspath(os.path.join(self.DataDir(), 'pyauto_private', 'apps', 374 self.DataDir(), 'pyauto_private', 'apps', 'countdown.crx'))
375 'countdown.crx')))
376 installed_app_id = self.InstallApp(app_crx_file) 375 installed_app_id = self.InstallApp(app_crx_file)
377 self.assertTrue(installed_app_id, msg='App install failed.') 376 self.assertTrue(installed_app_id, msg='App install failed.')
378 return installed_app_id 377 return installed_app_id
379 378
380 def testGetAppsInNewProfile(self): 379 def testGetAppsInNewProfile(self):
381 """Ensures that the only app in a new profile is the Web Store app.""" 380 """Ensures that the only app in a new profile is the Web Store app."""
382 app_info = self.GetNTPApps() 381 app_info = self.GetNTPApps()
383 self._VerifyAppInfo(app_info, self._EXPECTED_DEFAULT_APPS) 382 self._VerifyAppInfo(app_info, self._EXPECTED_DEFAULT_APPS)
384 383
385 def testGetAppsWhenInstallApp(self): 384 def testGetAppsWhenInstallApp(self):
386 """Ensures that an installed app is reflected in the app info in the NTP.""" 385 """Ensures that an installed app is reflected in the app info in the NTP."""
387 self._InstallAndVerifySamplePackagedApp() 386 self._InstallAndVerifySamplePackagedApp()
388 app_info = self.GetNTPApps() 387 app_info = self.GetNTPApps()
389 expected_app_info = [ 388 expected_app_info = [
390 { 389 {
391 u'name': u'Countdown' 390 u'name': u'Countdown'
392 } 391 }
393 ] 392 ]
394 expected_app_info.extend(self._EXPECTED_DEFAULT_APPS) 393 expected_app_info.extend(self._EXPECTED_DEFAULT_APPS)
395 self._VerifyAppInfo(app_info, expected_app_info) 394 self._VerifyAppInfo(app_info, expected_app_info)
396 395
397 def testGetAppsWhenInstallNonApps(self): 396 def testGetAppsWhenInstallNonApps(self):
398 """Ensures installed non-apps are not reflected in the NTP app info.""" 397 """Ensures installed non-apps are not reflected in the NTP app info."""
399 # Install a regular extension and a theme. 398 # Install a regular extension and a theme.
400 ext_crx_file = pyauto.FilePath( 399 ext_crx_file = os.path.abspath(os.path.join(self.DataDir(), 'extensions',
401 os.path.abspath(os.path.join(self.DataDir(), 'extensions', 400 'page_action.crx'))
402 'page_action.crx')))
403 self.assertTrue(self.InstallExtension(ext_crx_file, False), 401 self.assertTrue(self.InstallExtension(ext_crx_file, False),
404 msg='Extension install failed.') 402 msg='Extension install failed.')
405 theme_crx_file = pyauto.FilePath( 403 theme_crx_file = os.path.abspath(os.path.join(self.DataDir(), 'extensions',
406 os.path.abspath(os.path.join(self.DataDir(), 'extensions', 404 'theme.crx'))
407 'theme.crx')))
408 self.assertTrue(self.SetTheme(theme_crx_file), msg='Theme install failed.') 405 self.assertTrue(self.SetTheme(theme_crx_file), msg='Theme install failed.')
409 # Verify that no apps are listed on the NTP except for the Web Store. 406 # Verify that no apps are listed on the NTP except for the Web Store.
410 app_info = self.GetNTPApps() 407 app_info = self.GetNTPApps()
411 self._VerifyAppInfo(app_info, self._EXPECTED_DEFAULT_APPS) 408 self._VerifyAppInfo(app_info, self._EXPECTED_DEFAULT_APPS)
412 409
413 def testUninstallApp(self): 410 def testUninstallApp(self):
414 """Ensures that an uninstalled app is reflected in the NTP app info.""" 411 """Ensures that an uninstalled app is reflected in the NTP app info."""
415 # First, install an app and verify that it exists in the NTP app info. 412 # First, install an app and verify that it exists in the NTP app info.
416 installed_app_id = self._InstallAndVerifySamplePackagedApp() 413 installed_app_id = self._InstallAndVerifySamplePackagedApp()
417 app_info = self.GetNTPApps() 414 app_info = self.GetNTPApps()
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 thumb_info = self.GetNTPThumbnailMode() 715 thumb_info = self.GetNTPThumbnailMode()
719 expected_thumb_info = { 716 expected_thumb_info = {
720 u'apps': False, 717 u'apps': False,
721 u'most_visited': True 718 u'most_visited': True
722 } 719 }
723 self._VerifyThumbnailOrMenuMode(thumb_info, expected_thumb_info) 720 self._VerifyThumbnailOrMenuMode(thumb_info, expected_thumb_info)
724 721
725 722
726 if __name__ == '__main__': 723 if __name__ == '__main__':
727 pyauto_functional.Main() 724 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/memory.py ('k') | chrome/test/functional/themes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698