Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Side by Side Diff: base/test/trace_event_analyzer_unittest.cc

Issue 12150004: Category group support/Renamings. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: More renamings and category filter cleanups. Created 7 years, 10 months 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
OLDNEW
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/bind.h" 5 #include "base/bind.h"
6 #include "base/debug/trace_event_unittest.h" 6 #include "base/debug/trace_event_unittest.h"
7 #include "base/test/trace_event_analyzer.h" 7 #include "base/test/trace_event_analyzer.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 void TraceEventAnalyzerTest::OnTraceDataCollected( 34 void TraceEventAnalyzerTest::OnTraceDataCollected(
35 const scoped_refptr<base::RefCountedString>& json_events_str) { 35 const scoped_refptr<base::RefCountedString>& json_events_str) {
36 buffer_.AddFragment(json_events_str->data()); 36 buffer_.AddFragment(json_events_str->data());
37 } 37 }
38 38
39 void TraceEventAnalyzerTest::BeginTracing() { 39 void TraceEventAnalyzerTest::BeginTracing() {
40 output_.json_output.clear(); 40 output_.json_output.clear();
41 buffer_.Start(); 41 buffer_.Start();
42 base::debug::TraceLog::GetInstance()->SetEnabled(true); 42 base::debug::TraceLog::GetInstance()->SetEnabled(
43 base::debug::CategoryFilter("*"));
dsinclair 2013/02/22 21:13:44 nit: indenting.
43 } 44 }
44 45
45 void TraceEventAnalyzerTest::EndTracing() { 46 void TraceEventAnalyzerTest::EndTracing() {
46 base::debug::TraceLog::GetInstance()->SetEnabled(false); 47 base::debug::TraceLog::GetInstance()->SetDisabled();
47 base::debug::TraceLog::GetInstance()->Flush( 48 base::debug::TraceLog::GetInstance()->Flush(
48 base::Bind(&TraceEventAnalyzerTest::OnTraceDataCollected, 49 base::Bind(&TraceEventAnalyzerTest::OnTraceDataCollected,
49 base::Unretained(this))); 50 base::Unretained(this)));
50 buffer_.Finish(); 51 buffer_.Finish();
51 } 52 }
52 53
53 } // namespace 54 } // namespace
54 55
55 TEST_F(TraceEventAnalyzerTest, NoEvents) { 56 TEST_F(TraceEventAnalyzerTest, NoEvents) {
56 ManualSetUp(); 57 ManualSetUp();
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 EXPECT_EQ(num_events, CountMatches(event_ptrs, Query::Bool(true))); 817 EXPECT_EQ(num_events, CountMatches(event_ptrs, Query::Bool(true)));
817 EXPECT_EQ(num_events - 1, CountMatches(event_ptrs, Query::Bool(true), 818 EXPECT_EQ(num_events - 1, CountMatches(event_ptrs, Query::Bool(true),
818 1, num_events)); 819 1, num_events));
819 EXPECT_EQ(1u, CountMatches(event_ptrs, query_one)); 820 EXPECT_EQ(1u, CountMatches(event_ptrs, query_one));
820 EXPECT_EQ(num_events - 1, CountMatches(event_ptrs, !query_one)); 821 EXPECT_EQ(num_events - 1, CountMatches(event_ptrs, !query_one));
821 EXPECT_EQ(num_named, CountMatches(event_ptrs, query_named)); 822 EXPECT_EQ(num_named, CountMatches(event_ptrs, query_named));
822 } 823 }
823 824
824 825
825 } // namespace trace_analyzer 826 } // namespace trace_analyzer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698