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/test/trace_event_analyzer.h" | 5 #include "base/test/trace_event_analyzer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 TraceAnalyzer::Create(output_.json_output)); | 601 TraceAnalyzer::Create(output_.json_output)); |
602 ASSERT_TRUE(analyzer.get()); | 602 ASSERT_TRUE(analyzer.get()); |
603 analyzer->AssociateAsyncBeginEndEvents(); | 603 analyzer->AssociateAsyncBeginEndEvents(); |
604 | 604 |
605 TraceEventVector found; | 605 TraceEventVector found; |
606 analyzer->FindEvents(Query::MatchAsyncBeginWithNext(), &found); | 606 analyzer->FindEvents(Query::MatchAsyncBeginWithNext(), &found); |
607 ASSERT_EQ(3u, found.size()); | 607 ASSERT_EQ(3u, found.size()); |
608 | 608 |
609 EXPECT_STRCASEEQ("0xb", found[0]->id.c_str()); | 609 EXPECT_STRCASEEQ("0xb", found[0]->id.c_str()); |
610 EXPECT_EQ(TRACE_EVENT_PHASE_ASYNC_STEP_PAST, found[0]->other_event->phase); | 610 EXPECT_EQ(TRACE_EVENT_PHASE_ASYNC_STEP_PAST, found[0]->other_event->phase); |
| 611 EXPECT_EQ(found[0], found[0]->other_event->prev_event); |
611 EXPECT_TRUE(found[0]->other_event->other_event); | 612 EXPECT_TRUE(found[0]->other_event->other_event); |
612 EXPECT_EQ(TRACE_EVENT_PHASE_ASYNC_END, | 613 EXPECT_EQ(TRACE_EVENT_PHASE_ASYNC_END, |
613 found[0]->other_event->other_event->phase); | 614 found[0]->other_event->other_event->phase); |
| 615 EXPECT_EQ(found[0]->other_event, |
| 616 found[0]->other_event->other_event->prev_event); |
614 | 617 |
615 EXPECT_STRCASEEQ("0xc", found[1]->id.c_str()); | 618 EXPECT_STRCASEEQ("0xc", found[1]->id.c_str()); |
616 EXPECT_EQ(TRACE_EVENT_PHASE_ASYNC_STEP_INTO, found[1]->other_event->phase); | 619 EXPECT_EQ(TRACE_EVENT_PHASE_ASYNC_STEP_INTO, found[1]->other_event->phase); |
| 620 EXPECT_EQ(found[1], found[1]->other_event->prev_event); |
617 EXPECT_TRUE(found[1]->other_event->other_event); | 621 EXPECT_TRUE(found[1]->other_event->other_event); |
618 EXPECT_EQ(TRACE_EVENT_PHASE_ASYNC_STEP_INTO, | 622 EXPECT_EQ(TRACE_EVENT_PHASE_ASYNC_STEP_INTO, |
619 found[1]->other_event->other_event->phase); | 623 found[1]->other_event->other_event->phase); |
| 624 EXPECT_EQ(found[1]->other_event, |
| 625 found[1]->other_event->other_event->prev_event); |
620 double arg_actual = 0; | 626 double arg_actual = 0; |
621 EXPECT_TRUE(found[1]->other_event->other_event->GetArgAsNumber( | 627 EXPECT_TRUE(found[1]->other_event->other_event->GetArgAsNumber( |
622 "a", &arg_actual)); | 628 "a", &arg_actual)); |
623 EXPECT_EQ(1.0, arg_actual); | 629 EXPECT_EQ(1.0, arg_actual); |
624 EXPECT_TRUE(found[1]->other_event->other_event->other_event); | 630 EXPECT_TRUE(found[1]->other_event->other_event->other_event); |
625 EXPECT_EQ(TRACE_EVENT_PHASE_ASYNC_END, | 631 EXPECT_EQ(TRACE_EVENT_PHASE_ASYNC_END, |
626 found[1]->other_event->other_event->other_event->phase); | 632 found[1]->other_event->other_event->other_event->phase); |
627 | 633 |
628 EXPECT_STRCASEEQ("0xa", found[2]->id.c_str()); | 634 EXPECT_STRCASEEQ("0xa", found[2]->id.c_str()); |
629 EXPECT_EQ(TRACE_EVENT_PHASE_ASYNC_STEP_INTO, found[2]->other_event->phase); | 635 EXPECT_EQ(TRACE_EVENT_PHASE_ASYNC_STEP_INTO, found[2]->other_event->phase); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 std::unique_ptr<base::Value> arg; | 952 std::unique_ptr<base::Value> arg; |
947 events[0]->GetArgAsValue("arg", &arg); | 953 events[0]->GetArgAsValue("arg", &arg); |
948 base::DictionaryValue* arg_dict; | 954 base::DictionaryValue* arg_dict; |
949 EXPECT_TRUE(arg->GetAsDictionary(&arg_dict)); | 955 EXPECT_TRUE(arg->GetAsDictionary(&arg_dict)); |
950 std::string property; | 956 std::string property; |
951 EXPECT_TRUE(arg_dict->GetString("property", &property)); | 957 EXPECT_TRUE(arg_dict->GetString("property", &property)); |
952 EXPECT_EQ("value", property); | 958 EXPECT_EQ("value", property); |
953 } | 959 } |
954 | 960 |
955 } // namespace trace_analyzer | 961 } // namespace trace_analyzer |
OLD | NEW |