OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ppapi/tests/test_dev_trace_event.h" | |
6 | |
7 #include "ppapi/cpp/module.h" | |
8 #include "ppapi/tests/testing_instance.h" | |
9 | |
10 REGISTER_TEST_CASE(DevTraceEvent); | |
11 | |
12 TestDevTraceEvent::TestDevTraceEvent(TestingInstance* instance) | |
13 : TestCase(instance), | |
14 interface_(NULL) { | |
15 } | |
16 | |
17 bool TestDevTraceEvent::Init() { | |
18 interface_ = static_cast<const PPB_Trace_Event_Dev*>( | |
19 pp::Module::Get()->GetBrowserInterface(PPB_TRACE_EVENT_DEV_INTERFACE)); | |
20 return !!interface_; | |
21 } | |
22 | |
23 void TestDevTraceEvent::RunTests(const std::string& filter) { | |
24 RUN_TEST(Smoke, filter); | |
25 RUN_TEST(SmokeWithTimestamps, filter); | |
26 } | |
27 | |
28 std::string TestDevTraceEvent::TestSmoke() { | |
29 // This test does not verify the log message actually reaches dev tracing, but | |
30 // it does test that the interface exists and that it can be called without | |
31 // crashing. | |
32 const void* cat_enabled = interface_->GetCategoryEnabled(""); | |
bradn
2013/06/21 21:49:18
Maybe pass a non-empty?
grosse
2013/06/24 23:16:46
Done.
| |
33 interface_->AddTraceEvent('B', cat_enabled, "foo", 0, 0, NULL, NULL, NULL, 0); | |
34 interface_->AddTraceEvent('E', cat_enabled, "foo", 0, 0, NULL, NULL, NULL, 0); | |
35 PASS(); | |
36 } | |
37 | |
38 std::string TestDevTraceEvent::TestSmokeWithTimestamps() { | |
39 // This test does not verify the log message actually reaches dev tracing, but | |
40 // it does test that the interface exists and that it can be called without | |
41 // crashing. | |
42 const void* cat_enabled = interface_->GetCategoryEnabled(""); | |
43 interface_->AddTraceEventWithThreadIdAndTimestamp('B', cat_enabled, "foo", 0, | |
bradn
2013/06/21 21:49:18
Maybe use different name pair (foo, bar)?
grosse
2013/06/24 23:16:46
Ignored
| |
44 0, 42, 0, NULL, NULL, NULL, | |
45 0); | |
46 interface_->AddTraceEventWithThreadIdAndTimestamp('B', cat_enabled, "foo", 0, | |
47 1, 43, 0, NULL, NULL, NULL, | |
48 0); | |
49 interface_->AddTraceEventWithThreadIdAndTimestamp('E', cat_enabled, "foo", 0, | |
50 0, 44, 0, NULL, NULL, NULL, | |
51 0); | |
52 interface_->AddTraceEventWithThreadIdAndTimestamp('E', cat_enabled, "foo", 0, | |
53 1, 45, 0, NULL, NULL, NULL, | |
54 0); | |
55 PASS(); | |
56 } | |
OLD | NEW |