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

Unified Diff: tracing/tracing/model/thread_test.html

Issue 2804043003: [WIP] [DEFINITELY NOT READY TO LAND] Cpu time metric implementation (Closed)
Patch Set: Diff from base Created 3 years, 8 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
Index: tracing/tracing/model/thread_test.html
diff --git a/tracing/tracing/model/thread_test.html b/tracing/tracing/model/thread_test.html
index 55cbb346ef89998b8143e88f2c95908e7a10ca0c..8d5144f705f76816b84b7d5c274fb7aba517302b 100644
--- a/tracing/tracing/model/thread_test.html
+++ b/tracing/tracing/model/thread_test.html
@@ -180,6 +180,42 @@ tr.b.unittest.testSuite(function() {
});
});
});
+
+ test('typeGetterReturnsCorrectType', function() {
+ const model = tr.c.TestUtils.newModel(function(model) {
+ const process = model.getOrCreateProcess(1);
+ const thread1 = process.getOrCreateThread(1);
+ const thread2 = process.getOrCreateThread(2);
+ const thread3 = process.getOrCreateThread(3);
+ const thread4 = process.getOrCreateThread(4);
+
+ thread1.name = 'ThreadName12';
+ thread2.name = 'ThreadName/34123';
+ thread3.name = 'ThreadName1/34123';
+ thread4.name = 'ThreadName';
+
+ for (const thread of [thread1, thread2, thread3, thread4]) {
+ assert.equal(thread.type, 'ThreadName');
+ }
+ });
+ });
+
+ test('typeGetterThrowsIfThreadNameStartsWithNumberOrSlash', function() {
+ const model = tr.c.TestUtils.newModel(function(model) {
+ const process = model.getOrCreateProcess(1);
+ const thread1 = process.getOrCreateThread(1);
+ const thread2 = process.getOrCreateThread(2);
+ const thread3 = process.getOrCreateThread(3);
+
+ thread1.name = '123';
+ thread2.name = '42GPU';
+ thread3.name = '/123';
+
+ for (const thread of [thread1, thread2, thread3]) {
+ assert.throws(() => thread.type);
+ }
+ });
+ });
});
</script>
« tracing/tracing/extras/chrome/cpu_time_test_utils.html ('K') | « tracing/tracing/model/thread.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698