OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 | 4 |
5 #include "base/debug/trace_event_unittest.h" | 5 #include "base/debug/trace_event_unittest.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 trace_log->SetDisabled(); | 1524 trace_log->SetDisabled(); |
1525 } | 1525 } |
1526 | 1526 |
1527 TEST_F(TraceEventTestFixture, TraceOptionsParsing) { | 1527 TEST_F(TraceEventTestFixture, TraceOptionsParsing) { |
1528 ManualTestSetUp(); | 1528 ManualTestSetUp(); |
1529 | 1529 |
1530 EXPECT_EQ(TraceLog::RECORD_UNTIL_FULL, TraceLog::TraceOptionsFromString("")); | 1530 EXPECT_EQ(TraceLog::RECORD_UNTIL_FULL, TraceLog::TraceOptionsFromString("")); |
1531 | 1531 |
1532 EXPECT_EQ(TraceLog::RECORD_UNTIL_FULL, | 1532 EXPECT_EQ(TraceLog::RECORD_UNTIL_FULL, |
1533 TraceLog::TraceOptionsFromString("record-until-full")); | 1533 TraceLog::TraceOptionsFromString("record-until-full")); |
| 1534 EXPECT_EQ(TraceLog::RECORD_CONTINUOUSLY, |
| 1535 TraceLog::TraceOptionsFromString("record-continuously")); |
1534 } | 1536 } |
1535 | 1537 |
1536 TEST_F(TraceEventTestFixture, TraceSampling) { | 1538 TEST_F(TraceEventTestFixture, TraceSampling) { |
1537 ManualTestSetUp(); | 1539 ManualTestSetUp(); |
1538 | 1540 |
1539 event_watch_notification_ = 0; | 1541 event_watch_notification_ = 0; |
1540 TraceLog::GetInstance()->SetEnabled( | 1542 TraceLog::GetInstance()->SetEnabled( |
1541 std::string("*"), | 1543 std::string("*"), |
1542 TraceLog::Options(TraceLog::RECORD_UNTIL_FULL | | 1544 TraceLog::Options(TraceLog::RECORD_UNTIL_FULL | |
1543 TraceLog::ENABLE_SAMPLING)); | 1545 TraceLog::ENABLE_SAMPLING)); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1599 TraceLog::GetInstance()->SetEventCallback(Callback); | 1601 TraceLog::GetInstance()->SetEventCallback(Callback); |
1600 TRACE_EVENT_INSTANT0("all", "event1"); | 1602 TRACE_EVENT_INSTANT0("all", "event1"); |
1601 TRACE_EVENT_INSTANT0("all", "event2"); | 1603 TRACE_EVENT_INSTANT0("all", "event2"); |
1602 TraceLog::GetInstance()->SetEventCallback(NULL); | 1604 TraceLog::GetInstance()->SetEventCallback(NULL); |
1603 TRACE_EVENT_INSTANT0("all", "after callback removed"); | 1605 TRACE_EVENT_INSTANT0("all", "after callback removed"); |
1604 EXPECT_EQ(2u, collected_events_.size()); | 1606 EXPECT_EQ(2u, collected_events_.size()); |
1605 EXPECT_EQ("event1", collected_events_[0]); | 1607 EXPECT_EQ("event1", collected_events_[0]); |
1606 EXPECT_EQ("event2", collected_events_[1]); | 1608 EXPECT_EQ("event2", collected_events_[1]); |
1607 } | 1609 } |
1608 | 1610 |
| 1611 // TODO(dsinclair): Continuous Tracing unit test. |
| 1612 |
1609 } // namespace debug | 1613 } // namespace debug |
1610 } // namespace base | 1614 } // namespace base |
OLD | NEW |