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

Side by Side Diff: tools/android/adb_profile_chrome/perf_controller_unittest.py

Issue 310413003: Move adb_profile_chrome under tools/android/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add shebang and exec bit temporarily. Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 os 5 import os
6 import json 6 import json
7 7
8 from chrome_profiler import controllers_unittest 8 from adb_profile_chrome import controllers_unittest
9 from chrome_profiler import perf_controller 9 from adb_profile_chrome import perf_controller
10 10
11 11
12 class PerfProfilerControllerTest(controllers_unittest.BaseControllerTest): 12 class PerfProfilerControllerTest(controllers_unittest.BaseControllerTest):
13 def testGetCategories(self): 13 def testGetCategories(self):
14 if not perf_controller.PerfProfilerController.IsSupported(): 14 if not perf_controller.PerfProfilerController.IsSupported():
15 return 15 return
16 categories = \ 16 categories = \
17 perf_controller.PerfProfilerController.GetCategories(self.device) 17 perf_controller.PerfProfilerController.GetCategories(self.device)
18 assert 'cycles' in ' '.join(categories) 18 assert 'cycles' in ' '.join(categories)
19 19
20 def testTracing(self): 20 def testTracing(self):
21 if not perf_controller.PerfProfilerController.IsSupported(): 21 if not perf_controller.PerfProfilerController.IsSupported():
22 return 22 return
23 categories = ['cycles'] 23 categories = ['cycles']
24 controller = perf_controller.PerfProfilerController(self.device, 24 controller = perf_controller.PerfProfilerController(self.device,
25 categories) 25 categories)
26 26
27 interval = 1 27 interval = 1
28 try: 28 try:
29 controller.StartTracing(interval) 29 controller.StartTracing(interval)
30 finally: 30 finally:
31 controller.StopTracing() 31 controller.StopTracing()
32 32
33 result = controller.PullTrace() 33 result = controller.PullTrace()
34 try: 34 try:
35 with open(result) as f: 35 with open(result) as f:
36 json.loads(f.read()) 36 json.loads(f.read())
37 finally: 37 finally:
38 os.remove(result) 38 os.remove(result)
OLDNEW
« no previous file with comments | « tools/android/adb_profile_chrome/perf_controller.py ('k') | tools/android/adb_profile_chrome/profiler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698