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

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

Issue 2800933002: Add getter for thread type (Closed)
Patch Set: Address comments by benjhayden@ 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
« no previous file with comments | « tracing/tracing/model/thread.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..14ec67c9a806ffd2f74d705098d605919df569aa 100644
--- a/tracing/tracing/model/thread_test.html
+++ b/tracing/tracing/model/thread_test.html
@@ -180,6 +180,43 @@ 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';
+
+ assert.strictEqual(thread1.type, 'ThreadName');
+ assert.strictEqual(thread2.type, 'ThreadName');
+ assert.strictEqual(thread3.type, 'ThreadName');
+ assert.strictEqual(thread4.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';
+
+ assert.throws(() => thread1.type);
+ assert.throws(() => thread2.type);
+ assert.throws(() => thread3.type);
+ });
+ });
});
</script>
« no previous file with comments | « tracing/tracing/model/thread.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698