1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
# Copyright 2012 Canonical
4
# This program is free software: you can redistribute it and/or modify it
5
# under the terms of the GNU General Public License version 3, as published
6
# by the Free Software Foundation.
8
"""Kalossi-browser autopilot tests."""
13
from autopilot.introspection.qt import QtIntrospectionTestMixin
14
from autopilot.testcase import AutopilotTestCase
16
from kalossi_browser.emulators.main_window import MainWindow
18
class BrowserTestCase(AutopilotTestCase, QtIntrospectionTestMixin):
20
"""A common test case class that provides several useful methods for camera-app tests."""
23
super(BrowserTestCase, self).setUp()
24
# Lets assume we are installed system wide if this file is somewhere in /usr
25
if os.path.realpath(__file__).startswith("/usr/"):
26
self.launch_test_installed()
28
self.launch_test_local()
30
def launch_test_local(self):
31
self.app = self.launch_test_application(
32
"../../src/kalossi-browser")
34
def launch_test_installed(self):
35
if self.running_on_device():
36
self.app = self.launch_test_application(
40
self.app = self.launch_test_application(
44
def running_on_device():
45
return os.path.isfile('/system/usr/idc/autopilot-finger.idc')
48
def main_window(self):
49
return MainWindow(self.app)