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: test/cctest/libplatform/test-tracing.cc

Issue 2558193002: [Tracing] Support multi-categories group list. (Closed)
Patch Set: Add tests Created 4 years 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
« no previous file with comments | « src/libplatform/tracing/trace-config.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project 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 #include <limits> 4 #include <limits>
5 5
6 #include "include/libplatform/v8-tracing.h" 6 #include "include/libplatform/v8-tracing.h"
7 #include "src/tracing/trace-event.h" 7 #include "src/tracing/trace-event.h"
8 #include "test/cctest/cctest.h" 8 #include "test/cctest/cctest.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace platform { 11 namespace platform {
12 namespace tracing { 12 namespace tracing {
13 13
14 TEST(TestTraceConfig) { 14 TEST(TestTraceConfig) {
15 LocalContext env; 15 LocalContext env;
16 TraceConfig* trace_config = new TraceConfig(); 16 TraceConfig* trace_config = new TraceConfig();
17 trace_config->AddIncludedCategory("v8"); 17 trace_config->AddIncludedCategory("v8");
18 trace_config->AddIncludedCategory(TRACE_DISABLED_BY_DEFAULT("v8.runtime")); 18 trace_config->AddIncludedCategory(TRACE_DISABLED_BY_DEFAULT("v8.runtime"));
19 19
20 CHECK_EQ(trace_config->IsSystraceEnabled(), false); 20 CHECK_EQ(trace_config->IsSystraceEnabled(), false);
21 CHECK_EQ(trace_config->IsArgumentFilterEnabled(), false); 21 CHECK_EQ(trace_config->IsArgumentFilterEnabled(), false);
22 CHECK_EQ(trace_config->IsCategoryGroupEnabled("v8"), true); 22 CHECK_EQ(trace_config->IsCategoryGroupEnabled("v8"), true);
23 CHECK_EQ(trace_config->IsCategoryGroupEnabled("v8.cpu_profile"), false); 23 CHECK_EQ(trace_config->IsCategoryGroupEnabled("v8.cpu_profile"), false);
24 CHECK_EQ(trace_config->IsCategoryGroupEnabled("v8.cpu_profile.hires"), false); 24 CHECK_EQ(trace_config->IsCategoryGroupEnabled("v8.cpu_profile.hires"), false);
25 CHECK_EQ(trace_config->IsCategoryGroupEnabled( 25 CHECK_EQ(trace_config->IsCategoryGroupEnabled(
26 TRACE_DISABLED_BY_DEFAULT("v8.runtime")), 26 TRACE_DISABLED_BY_DEFAULT("v8.runtime")),
27 true); 27 true);
28 CHECK_EQ(trace_config->IsCategoryGroupEnabled("v8,v8.cpu_profile"), true);
29 CHECK_EQ(
30 trace_config->IsCategoryGroupEnabled("v8,disabled-by-default-v8.runtime"),
31 true);
32 CHECK_EQ(trace_config->IsCategoryGroupEnabled(
33 "v8_cpu_profile,v8.cpu_profile.hires"),
34 false);
35
28 delete trace_config; 36 delete trace_config;
29 } 37 }
30 38
31 TEST(TestTraceObject) { 39 TEST(TestTraceObject) {
32 TraceObject trace_object; 40 TraceObject trace_object;
33 uint8_t category_enabled_flag = 41; 41 uint8_t category_enabled_flag = 41;
34 trace_object.Initialize('X', &category_enabled_flag, "Test.Trace", 42 trace_object.Initialize('X', &category_enabled_flag, "Test.Trace",
35 "Test.Scope", 42, 123, 0, nullptr, nullptr, nullptr, 43 "Test.Scope", 42, 123, 0, nullptr, nullptr, nullptr,
36 nullptr, 0); 44 nullptr, 0);
37 CHECK_EQ('X', trace_object.phase()); 45 CHECK_EQ('X', trace_object.phase());
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 406
399 CHECK_EQ(1, observer.enabled_count); 407 CHECK_EQ(1, observer.enabled_count);
400 CHECK_EQ(1, observer.disabled_count); 408 CHECK_EQ(1, observer.disabled_count);
401 409
402 i::V8::SetPlatformForTesting(old_platform); 410 i::V8::SetPlatformForTesting(old_platform);
403 } 411 }
404 412
405 } // namespace tracing 413 } // namespace tracing
406 } // namespace platform 414 } // namespace platform
407 } // namespace v8 415 } // namespace v8
OLDNEW
« no previous file with comments | « src/libplatform/tracing/trace-config.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698