| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/test/trace_event_analyzer.h" | 6 #include "base/test/trace_event_analyzer.h" |
| 7 #include "testing/gmock/include/gmock/gmock.h" | 7 #include "testing/gmock/include/gmock/gmock.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace trace_analyzer { | 10 namespace trace_analyzer { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 | 102 |
| 103 TEST_F(TraceEventAnalyzerTest, QueryEventMember) { | 103 TEST_F(TraceEventAnalyzerTest, QueryEventMember) { |
| 104 using namespace trace_analyzer; | 104 using namespace trace_analyzer; |
| 105 ManualSetUp(); | 105 ManualSetUp(); |
| 106 | 106 |
| 107 TraceEvent event; | 107 TraceEvent event; |
| 108 event.thread.process_id = 3; | 108 event.thread.process_id = 3; |
| 109 event.thread.thread_id = 4; | 109 event.thread.thread_id = 4; |
| 110 event.timestamp = 1.5; | 110 event.timestamp = 1.5; |
| 111 event.phase = base::debug::TRACE_EVENT_PHASE_BEGIN; | 111 event.phase = TRACE_EVENT_PHASE_BEGIN; |
| 112 event.category = "category"; | 112 event.category = "category"; |
| 113 event.name = "name"; | 113 event.name = "name"; |
| 114 event.arg_numbers["num"] = 7.0; | 114 event.arg_numbers["num"] = 7.0; |
| 115 event.arg_strings["str"] = "the string"; | 115 event.arg_strings["str"] = "the string"; |
| 116 | 116 |
| 117 // Other event with all different members: | 117 // Other event with all different members: |
| 118 TraceEvent other; | 118 TraceEvent other; |
| 119 other.thread.process_id = 5; | 119 other.thread.process_id = 5; |
| 120 other.thread.thread_id = 6; | 120 other.thread.thread_id = 6; |
| 121 other.timestamp = 2.5; | 121 other.timestamp = 2.5; |
| 122 other.phase = base::debug::TRACE_EVENT_PHASE_END; | 122 other.phase = TRACE_EVENT_PHASE_END; |
| 123 other.category = "category2"; | 123 other.category = "category2"; |
| 124 other.name = "name2"; | 124 other.name = "name2"; |
| 125 other.arg_numbers["num2"] = 8.0; | 125 other.arg_numbers["num2"] = 8.0; |
| 126 other.arg_strings["str2"] = "the string 2"; | 126 other.arg_strings["str2"] = "the string 2"; |
| 127 | 127 |
| 128 event.other_event = &other; | 128 event.other_event = &other; |
| 129 ASSERT_TRUE(event.has_other_event()); | 129 ASSERT_TRUE(event.has_other_event()); |
| 130 double duration = event.GetAbsTimeToOtherEvent(); | 130 double duration = event.GetAbsTimeToOtherEvent(); |
| 131 | 131 |
| 132 Query event_pid = (Query(EVENT_PID) == Query::Int(event.thread.process_id)); | 132 Query event_pid = (Query(EVENT_PID) == Query::Int(event.thread.process_id)); |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 EXPECT_TRUE((Query::Double(1.0) == Query::Double(1.0f)).Evaluate(dummy)); | 523 EXPECT_TRUE((Query::Double(1.0) == Query::Double(1.0f)).Evaluate(dummy)); |
| 524 EXPECT_TRUE((Query::Bool(true) == Query::Int(1)).Evaluate(dummy)); | 524 EXPECT_TRUE((Query::Bool(true) == Query::Int(1)).Evaluate(dummy)); |
| 525 EXPECT_TRUE((Query::Bool(false) == Query::Int(0)).Evaluate(dummy)); | 525 EXPECT_TRUE((Query::Bool(false) == Query::Int(0)).Evaluate(dummy)); |
| 526 EXPECT_TRUE((Query::Bool(true) == Query::Double(1.0f)).Evaluate(dummy)); | 526 EXPECT_TRUE((Query::Bool(true) == Query::Double(1.0f)).Evaluate(dummy)); |
| 527 EXPECT_TRUE((Query::Bool(false) == Query::Double(0.0f)).Evaluate(dummy)); | 527 EXPECT_TRUE((Query::Bool(false) == Query::Double(0.0f)).Evaluate(dummy)); |
| 528 } | 528 } |
| 529 | 529 |
| 530 | 530 |
| 531 } // namespace trace_analyzer | 531 } // namespace trace_analyzer |
| 532 | 532 |
| OLD | NEW |