
import os

import pyauto_functional  # must be imported before pyauto
import pyauto


class ChromeosHTMLTerminalTest(pyauto.PyUITest):
  """Basic tests for ChromeOS HTML Terminal.

  Requires ChromeOS to be logged in.
  """

  def _GetExtensionInfoById(self, extensions, id):
    for x in extensions:
      if x['id'] == id:
        return x
    return None

  def testInstallHTMLTerminal(self):
    """Basic installation test for HTML Terminal on ChromeOS."""
    crx_file_path = os.path.abspath(
        os.path.join(self.DataDir(), 'pyauto_private', 'apps',
                     'SecureShell-dev-0.7.9.3.crx'))
    ext_id = self.InstallExtension(crx_file_path)
    self.assertTrue(ext_id, 'Failed to install extension.')
    extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id)
    self.assertTrue(extension['is_enabled'],
                    msg='Extension was not enabled on installation.')
    self.assertFalse(extension['allowed_in_incognito'],
                     msg='Extension was allowed in incognito on installation.')


if __name__ == '__main__':
  pyauto_functional.Main()


import os

import pyauto_functional  # must be imported before pyauto
import pyauto


class ChromeosHTMLTerminalTest(pyauto.PyUITest):
  """Basic tests for ChromeOS HTML Terminal.

  Requires ChromeOS to be logged in.
  """

  def _GetExtensionInfoById(self, extensions, id):
    for x in extensions:
      if x['id'] == id:
        return x
    return None

  def testInstallAndUninstallSecureShellExt(self):
    """Basic installation test for HTML Terminal on ChromeOS."""
    crx_file_path = os.path.abspath(
        os.path.join(self.DataDir(), 'pyauto_private', 'apps',
                     'SecureShell-dev-0.7.9.3.crx'))
    ext_id = self.InstallExtension(crx_file_path)
    self.assertTrue(ext_id, 'Failed to install extension.')
    extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id)
    self.assertTrue(extension['is_enabled'],
                    msg='Extension was not enabled on installation.')
    self.assertFalse(extension['allowed_in_incognito'],
                     msg='Extension was allowed in incognito on installation.')
    # Uninstall HTML Terminal extension
    self.assertTrue(self.UninstallExtensionById(ext_id),
                    msg='Failed to uninstall extension.')


if __name__ == '__main__':
  pyauto_functional.Main()

Add uninstall HTML Terminal extension
Add uninstall HTML Terminal extension

BUG=
TEST=This is a test to uninstall HTML terminal extension


Review URL: https://chromiumcodereview.appspot.com/10332227

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@137790 0039d316-1c4b-4281-b951-d872f2087c98

  
  import os
  
  import pyauto_functional  # must be imported before pyauto
  import pyauto
  
  
  class ChromeosHTMLTerminalTest(pyauto.PyUITest):
    """Basic tests for ChromeOS HTML Terminal.
  
    Requires ChromeOS to be logged in.
    """
  
    def _GetExtensionInfoById(self, extensions, id):
      for x in extensions:
        if x['id'] == id:
          return x
      return None
  
-   def testInstallHTMLTerminal(self):
+   def testInstallAndUninstallSecureShellExt(self):
      """Basic installation test for HTML Terminal on ChromeOS."""
      crx_file_path = os.path.abspath(
          os.path.join(self.DataDir(), 'pyauto_private', 'apps',
                       'SecureShell-dev-0.7.9.3.crx'))
      ext_id = self.InstallExtension(crx_file_path)
      self.assertTrue(ext_id, 'Failed to install extension.')
      extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id)
      self.assertTrue(extension['is_enabled'],
                      msg='Extension was not enabled on installation.')
      self.assertFalse(extension['allowed_in_incognito'],
                       msg='Extension was allowed in incognito on installation.')
+     # Uninstall HTML Terminal extension
+     self.assertTrue(self.UninstallExtensionById(ext_id),
+                     msg='Failed to uninstall extension.')
  
  
  if __name__ == '__main__':
    pyauto_functional.Main()
  
Add uninstall HTML Terminal extension
## Code Before:

import os

import pyauto_functional  # must be imported before pyauto
import pyauto


class ChromeosHTMLTerminalTest(pyauto.PyUITest):
  """Basic tests for ChromeOS HTML Terminal.

  Requires ChromeOS to be logged in.
  """

  def _GetExtensionInfoById(self, extensions, id):
    for x in extensions:
      if x['id'] == id:
        return x
    return None

  def testInstallHTMLTerminal(self):
    """Basic installation test for HTML Terminal on ChromeOS."""
    crx_file_path = os.path.abspath(
        os.path.join(self.DataDir(), 'pyauto_private', 'apps',
                     'SecureShell-dev-0.7.9.3.crx'))
    ext_id = self.InstallExtension(crx_file_path)
    self.assertTrue(ext_id, 'Failed to install extension.')
    extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id)
    self.assertTrue(extension['is_enabled'],
                    msg='Extension was not enabled on installation.')
    self.assertFalse(extension['allowed_in_incognito'],
                     msg='Extension was allowed in incognito on installation.')


if __name__ == '__main__':
  pyauto_functional.Main()

## Instruction:
Add uninstall HTML Terminal extension
## Code After:

import os

import pyauto_functional  # must be imported before pyauto
import pyauto


class ChromeosHTMLTerminalTest(pyauto.PyUITest):
  """Basic tests for ChromeOS HTML Terminal.

  Requires ChromeOS to be logged in.
  """

  def _GetExtensionInfoById(self, extensions, id):
    for x in extensions:
      if x['id'] == id:
        return x
    return None

  def testInstallAndUninstallSecureShellExt(self):
    """Basic installation test for HTML Terminal on ChromeOS."""
    crx_file_path = os.path.abspath(
        os.path.join(self.DataDir(), 'pyauto_private', 'apps',
                     'SecureShell-dev-0.7.9.3.crx'))
    ext_id = self.InstallExtension(crx_file_path)
    self.assertTrue(ext_id, 'Failed to install extension.')
    extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id)
    self.assertTrue(extension['is_enabled'],
                    msg='Extension was not enabled on installation.')
    self.assertFalse(extension['allowed_in_incognito'],
                     msg='Extension was allowed in incognito on installation.')
    # Uninstall HTML Terminal extension
    self.assertTrue(self.UninstallExtensionById(ext_id),
                    msg='Failed to uninstall extension.')


if __name__ == '__main__':
  pyauto_functional.Main()
