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

Side by Side Diff: telemetry/examples/browser_tests/simple_browser_test.py

Issue 2700563004: [Telemetry] Migrate browser_test_runner to use typ as the test runner (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # 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
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import sys 5 import sys
6 import os 6 import os
7 7
8 from telemetry.testing import serially_executed_browser_test_case 8 from telemetry.testing import serially_executed_browser_test_case
9 9
10 10
11 def ConvertPathToTestName(url): 11 def ConvertPathToTestName(url):
12 return url.replace('.', '_') 12 return url.replace('.', '_')
13 13
14 14
15 class SimpleBrowserTest( 15 class SimpleBrowserTest(
16 serially_executed_browser_test_case.SeriallyExecutedBrowserTestCase): 16 serially_executed_browser_test_case.SeriallyExecutedBrowserTestCase):
17 17
18 @classmethod 18 @classmethod
19 def GenerateTestCases_JavascriptTest(cls, options): 19 def GenerateTestCases_JavascriptTest(cls, options):
20 del options # unused 20 del options # unused
21 for path in ['page_with_link.html', 'page_with_clickables.html']: 21 for path in ['page_with_link.html', 'page_with_clickables.html']:
22 yield 'add_1_and_2_' + ConvertPathToTestName(path), (path, 1, 2, 3) 22 yield 'add_1_and_2_' + ConvertPathToTestName(path), (path, 1, 2, 3)
23 23
24 @classmethod 24 @classmethod
25 def setUpClass(cls): 25 def SetUpProcess(cls):
26 super(cls, SimpleBrowserTest).setUpClass() 26 super(cls, SimpleBrowserTest).SetUpProcess()
27 cls.SetBrowserOptions(cls._finder_options) 27 cls.SetBrowserOptions(cls._finder_options)
28 cls.StartBrowser() 28 cls.StartBrowser()
29 cls.action_runner = cls.browser.tabs[0].action_runner 29 cls.action_runner = cls.browser.tabs[0].action_runner
30 cls.SetStaticServerDirs( 30 cls.SetStaticServerDirs(
31 [os.path.join(os.path.abspath(__file__), '..', 'pages')]) 31 [os.path.join(os.path.abspath(__file__), '..', 'pages')])
32 32
33 def JavascriptTest(self, file_path, num_1, num_2, expected_sum): 33 def JavascriptTest(self, file_path, num_1, num_2, expected_sum):
34 url = self.UrlOfStaticFilePath(file_path) 34 url = self.UrlOfStaticFilePath(file_path)
35 self.action_runner.Navigate(url) 35 self.action_runner.Navigate(url)
36 actual_sum = self.action_runner.EvaluateJavaScript2( 36 actual_sum = self.action_runner.EvaluateJavaScript2(
(...skipping 29 matching lines...) Expand all
66 self.action_runner.ExecuteJavaScript2('valueSettableByTest = 1997') 66 self.action_runner.ExecuteJavaScript2('valueSettableByTest = 1997')
67 self.action_runner.ClickElement(text='Click/tap me') 67 self.action_runner.ClickElement(text='Click/tap me')
68 self.assertEqual( 68 self.assertEqual(
69 1997, self.action_runner.EvaluateJavaScript2('valueToTest')) 69 1997, self.action_runner.EvaluateJavaScript2('valueToTest'))
70 70
71 71
72 def load_tests(loader, tests, pattern): 72 def load_tests(loader, tests, pattern):
73 del loader, tests, pattern # Unused. 73 del loader, tests, pattern # Unused.
74 return serially_executed_browser_test_case.LoadAllTestsInModule( 74 return serially_executed_browser_test_case.LoadAllTestsInModule(
75 sys.modules[__name__]) 75 sys.modules[__name__])
OLDNEW
« no previous file with comments | « telemetry/examples/browser_tests/sample_unittest.py ('k') | telemetry/telemetry/testing/browser_test_context.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698