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

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

Issue 12302036: Add a mode flag to the tracing framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. 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 | Annotate | Revision Log
« no previous file with comments | « base/debug/trace_event_unittest.cc ('k') | chrome/browser/automation/automation_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 true,
44 base::debug::TraceLog::RECORD_UNTIL_FULL);
43 } 45 }
44 46
45 void TraceEventAnalyzerTest::EndTracing() { 47 void TraceEventAnalyzerTest::EndTracing() {
46 base::debug::TraceLog::GetInstance()->SetEnabled(false); 48 base::debug::TraceLog::GetInstance()->SetEnabled(
49 false,
50 base::debug::TraceLog::RECORD_UNTIL_FULL);
47 base::debug::TraceLog::GetInstance()->Flush( 51 base::debug::TraceLog::GetInstance()->Flush(
48 base::Bind(&TraceEventAnalyzerTest::OnTraceDataCollected, 52 base::Bind(&TraceEventAnalyzerTest::OnTraceDataCollected,
49 base::Unretained(this))); 53 base::Unretained(this)));
50 buffer_.Finish(); 54 buffer_.Finish();
51 } 55 }
52 56
53 } // namespace 57 } // namespace
54 58
55 TEST_F(TraceEventAnalyzerTest, NoEvents) { 59 TEST_F(TraceEventAnalyzerTest, NoEvents) {
56 ManualSetUp(); 60 ManualSetUp();
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 EXPECT_EQ(num_events, CountMatches(event_ptrs, Query::Bool(true))); 820 EXPECT_EQ(num_events, CountMatches(event_ptrs, Query::Bool(true)));
817 EXPECT_EQ(num_events - 1, CountMatches(event_ptrs, Query::Bool(true), 821 EXPECT_EQ(num_events - 1, CountMatches(event_ptrs, Query::Bool(true),
818 1, num_events)); 822 1, num_events));
819 EXPECT_EQ(1u, CountMatches(event_ptrs, query_one)); 823 EXPECT_EQ(1u, CountMatches(event_ptrs, query_one));
820 EXPECT_EQ(num_events - 1, CountMatches(event_ptrs, !query_one)); 824 EXPECT_EQ(num_events - 1, CountMatches(event_ptrs, !query_one));
821 EXPECT_EQ(num_named, CountMatches(event_ptrs, query_named)); 825 EXPECT_EQ(num_named, CountMatches(event_ptrs, query_named));
822 } 826 }
823 827
824 828
825 } // namespace trace_analyzer 829 } // namespace trace_analyzer
OLDNEW
« no previous file with comments | « base/debug/trace_event_unittest.cc ('k') | chrome/browser/automation/automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698