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

Unified Diff: telemetry/telemetry/value/trace_unittest.py

Issue 1980773002: [BattOr][Telemetry] Changes needed to run BattOr tests on telemetry. (Closed) Base URL: git@github.com:catapult-project/catapult@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « telemetry/telemetry/value/trace.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/value/trace_unittest.py
diff --git a/telemetry/telemetry/value/trace_unittest.py b/telemetry/telemetry/value/trace_unittest.py
index 5b90ec661f6c7d58030a530b0315ea96576a992b..39f7d724477994855d8e2f9342090556bbf743a9 100644
--- a/telemetry/telemetry/value/trace_unittest.py
+++ b/telemetry/telemetry/value/trace_unittest.py
@@ -12,6 +12,7 @@ from telemetry import page as page_module
from telemetry.testing import system_stub
from telemetry.timeline import trace_data
from telemetry.value import trace
+from tracing_build import html2trace
class TestBase(unittest.TestCase):
@@ -104,6 +105,41 @@ class ValueTest(TestBase):
test_temp_file.close()
os.remove(test_temp_file.name)
+ def testFindTraceParts(self):
+ raw_data = {
+ 'powerTraceAsString': 'Battor Data',
+ 'traceEvents': 'Chrome Data',
+ 'tabIds': 'Tab Data',
+ }
+ data = trace_data.TraceData(raw_data)
+ v = trace.TraceValue(None, data)
+ tempdir = tempfile.mkdtemp()
+ temp_path = os.path.join(tempdir, 'test.json')
+ battor_seen = False
+ chrome_seen = False
+ tabs_seen = False
+ try:
+ trace_files = html2trace.CopyTraceDataFromHTMLFilePath(v.filename,
+ temp_path)
+ for f in trace_files:
+ with open(f, 'r') as trace_file:
+ d = trace_file.read()
+ if d == raw_data['powerTraceAsString']:
+ self.assertFalse(battor_seen)
+ battor_seen = True
+ elif d == raw_data['traceEvents']:
+ self.assertFalse(chrome_seen)
+ chrome_seen = True
+ elif d == raw_data['tabIds']:
+ self.assertFalse(tabs_seen)
+ tabs_seen = True
+ self.assertTrue(battor_seen)
+ self.assertTrue(chrome_seen)
+ self.assertTrue(tabs_seen)
+ finally:
+ shutil.rmtree(tempdir)
+ os.remove(v.filename)
+
def _IsEmptyDir(path):
return os.path.exists(path) and not os.listdir(path)
« no previous file with comments | « telemetry/telemetry/value/trace.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698