#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os

import pyauto_functional # must be imported before pyauto
import pyauto


class ChromeosPrivateViewTest(pyauto.PyUITest):
  """Basic tests for ChromeOS Private View.

  Requires ChromeOS to be logged in.
  """

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

  def testInstallPrivateViewExtension(self):
    """Basic installation test for Private View on ChromeOS."""
    crx_file_path = os.path.abspath(
        os.path.join(self.DataDir(), 'pyauto_private', 'apps',
                     'privateview-chrome-1.0.800_RELEASE.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()

#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os

import pyauto_functional # must be imported before pyauto
import pyauto


class ChromeosPrivateViewTest(pyauto.PyUITest):
  """Basic tests for ChromeOS Private View.

  Requires ChromeOS to be logged in.
  """

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

  def testInstallPrivateViewExtension(self):
    """Basic installation test for Private View on ChromeOS."""
    crx_file_path = os.path.abspath(
        os.path.join(self.DataDir(), 'pyauto_private', 'apps',
                     'privateview-chrome-2.2.28_RELEASE.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()

Modify pyauto test ChromeosPrivateViewTest to use 2.2.28 data file.
Modify pyauto test ChromeosPrivateViewTest to use 2.2.28 data file.

BUG=none
TEST=This is a test.

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

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