| OLD | NEW |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 5 | 4 |
| 6 """Runs sample updater and install tests using one or more Chrome builds. | 5 """Tests that demonstrate use of install test framework.""" |
| 7 | |
| 8 Test requires two arguments: build url and chrome versions to be used, rest of | |
| 9 the arguments are optional. Builds must be specified in ascending order, with | |
| 10 the lower version first and the higher version last, each separated by commas. | |
| 11 Separate arguments are required for install and update test scenarios. The | |
| 12 setUp method creates a ChromeDriver instance, which can be used to run tests. | |
| 13 ChromeDriver is shutdown upon completion of the testcase. | |
| 14 | |
| 15 Example: | |
| 16 $ python sample_updater.py --url=<URL> --builds=19.0.1069.0,19.0.1070.0 | |
| 17 """ | |
| 18 | 6 |
| 19 import os | 7 import os |
| 20 import sys | 8 import sys |
| 21 import unittest | 9 import unittest |
| 22 | 10 |
| 23 from install_test import InstallTest | 11 from install_test import InstallTest |
| 24 from install_test import Main | |
| 25 | 12 |
| 26 | 13 |
| 27 class SampleUpdater(InstallTest): | 14 class SampleUpdater(InstallTest): |
| 28 """Sample update tests.""" | 15 """Sample update tests.""" |
| 29 | 16 |
| 30 def testCanOpenGoogle(self): | 17 def testCanOpenGoogle(self): |
| 31 """Simple Navigation. | 18 """Simple Navigation. |
| 32 | 19 |
| 33 This test case illustrates how to run an update test. Update tests require | 20 This test case illustrates how to run an update test. Update tests require |
| 34 two or more builds. | 21 two or more builds. |
| 35 """ | 22 """ |
| 36 self.Install(self.GetUpdateBuilds()[0]) | 23 self.Install(self.GetUpdateBuilds()[0]) |
| 37 self.StartChrome() | 24 self.StartChrome() |
| 38 self._driver.get('http://www.google.com/') | 25 self._driver.get('http://www.google.com/') |
| 39 self.Install(self.GetUpdateBuilds()[1]) | 26 self.Install(self.GetUpdateBuilds()[1]) |
| 40 self.StartChrome() | 27 self.StartChrome() |
| 41 self._driver.get('http://www.google.org/') | 28 self._driver.get('http://www.google.org/') |
| 42 | 29 |
| 43 def testCanOpenGoogleOrg(self): | 30 def testCanOpenGoogleOrg(self): |
| 44 """Simple Navigation. | 31 """Simple Navigation. |
| 45 | 32 |
| 46 This test case illustrates how to run a fresh install test. Simple install | 33 This test case illustrates how to run a fresh install test. Simple install |
| 47 tests, unlike update test, require only a single build. | 34 tests, unlike update test, require only a single build. |
| 48 """ | 35 """ |
| 49 self.Install(self.GetInstallBuild()) | 36 self.Install(self.GetInstallBuild()) |
| 50 self.StartChrome() | 37 self.StartChrome() |
| 51 self._driver.get('http://www.google.org/') | 38 self._driver.get('http://www.google.org/') |
| 52 | |
| 53 | |
| 54 if __name__ == '__main__': | |
| 55 Main() | |
| OLD | NEW |