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

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

Issue 18338004: Don't use StaticMemorySingletonTraits for TraceLog. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: no need for ManualTestSetUp anymore per scheib Created 7 years, 5 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_win_unittest.cc ('k') | no next file » | 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
11 namespace trace_analyzer { 11 namespace trace_analyzer {
12 12
13 namespace { 13 namespace {
14 14
15 class TraceEventAnalyzerTest : public testing::Test { 15 class TraceEventAnalyzerTest : public testing::Test {
16 public: 16 public:
17 void ManualSetUp(); 17 void ManualSetUp();
18 void OnTraceDataCollected( 18 void OnTraceDataCollected(
19 const scoped_refptr<base::RefCountedString>& json_events_str); 19 const scoped_refptr<base::RefCountedString>& json_events_str);
20 void BeginTracing(); 20 void BeginTracing();
21 void EndTracing(); 21 void EndTracing();
22 22
23 base::debug::TraceResultBuffer::SimpleOutput output_; 23 base::debug::TraceResultBuffer::SimpleOutput output_;
24 base::debug::TraceResultBuffer buffer_; 24 base::debug::TraceResultBuffer buffer_;
25 }; 25 };
26 26
27 void TraceEventAnalyzerTest::ManualSetUp() { 27 void TraceEventAnalyzerTest::ManualSetUp() {
28 base::debug::TraceLog::Resurrect();
29 ASSERT_TRUE(base::debug::TraceLog::GetInstance()); 28 ASSERT_TRUE(base::debug::TraceLog::GetInstance());
30 buffer_.SetOutputCallback(output_.GetCallback()); 29 buffer_.SetOutputCallback(output_.GetCallback());
31 output_.json_output.clear(); 30 output_.json_output.clear();
32 } 31 }
33 32
34 void TraceEventAnalyzerTest::OnTraceDataCollected( 33 void TraceEventAnalyzerTest::OnTraceDataCollected(
35 const scoped_refptr<base::RefCountedString>& json_events_str) { 34 const scoped_refptr<base::RefCountedString>& json_events_str) {
36 buffer_.AddFragment(json_events_str->data()); 35 buffer_.AddFragment(json_events_str->data());
37 } 36 }
38 37
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 EXPECT_EQ(num_events, CountMatches(event_ptrs, Query::Bool(true))); 826 EXPECT_EQ(num_events, CountMatches(event_ptrs, Query::Bool(true)));
828 EXPECT_EQ(num_events - 1, CountMatches(event_ptrs, Query::Bool(true), 827 EXPECT_EQ(num_events - 1, CountMatches(event_ptrs, Query::Bool(true),
829 1, num_events)); 828 1, num_events));
830 EXPECT_EQ(1u, CountMatches(event_ptrs, query_one)); 829 EXPECT_EQ(1u, CountMatches(event_ptrs, query_one));
831 EXPECT_EQ(num_events - 1, CountMatches(event_ptrs, !query_one)); 830 EXPECT_EQ(num_events - 1, CountMatches(event_ptrs, !query_one));
832 EXPECT_EQ(num_named, CountMatches(event_ptrs, query_named)); 831 EXPECT_EQ(num_named, CountMatches(event_ptrs, query_named));
833 } 832 }
834 833
835 834
836 } // namespace trace_analyzer 835 } // namespace trace_analyzer
OLDNEW
« no previous file with comments | « base/debug/trace_event_win_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698