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/debug/trace_event_unittest.h" | 5 #include "base/debug/trace_event_unittest.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
13 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
14 #include "base/memory/ref_counted_memory.h" | 14 #include "base/memory/ref_counted_memory.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
17 #include "base/process_util.h" | 17 #include "base/process_util.h" |
18 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
19 #include "base/synchronization/waitable_event.h" | 19 #include "base/synchronization/waitable_event.h" |
20 #include "base/threading/platform_thread.h" | 20 #include "base/threading/platform_thread.h" |
21 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
22 #include "base/values.h" | 22 #include "base/values.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 | 25 |
| 26 #if !defined(NO_TCMALLOC) && !defined(OS_NACL) && defined(OS_LINUX) |
| 27 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" |
| 28 #endif |
| 29 |
26 using base::debug::HighResSleepForTraceTest; | 30 using base::debug::HighResSleepForTraceTest; |
27 | 31 |
28 namespace base { | 32 namespace base { |
29 namespace debug { | 33 namespace debug { |
30 | 34 |
31 namespace { | 35 namespace { |
32 | 36 |
33 enum CompareOp { | 37 enum CompareOp { |
34 IS_EQUAL, | 38 IS_EQUAL, |
35 IS_NOT_EQUAL, | 39 IS_NOT_EQUAL, |
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1991 EXPECT_TRUE(CategoryFilter::IsEmptyOrContainsLeadingOrTrailingWhitespace( | 1995 EXPECT_TRUE(CategoryFilter::IsEmptyOrContainsLeadingOrTrailingWhitespace( |
1992 "bad_category ")); | 1996 "bad_category ")); |
1993 EXPECT_TRUE(CategoryFilter::IsEmptyOrContainsLeadingOrTrailingWhitespace( | 1997 EXPECT_TRUE(CategoryFilter::IsEmptyOrContainsLeadingOrTrailingWhitespace( |
1994 " bad_category ")); | 1998 " bad_category ")); |
1995 EXPECT_TRUE(CategoryFilter::IsEmptyOrContainsLeadingOrTrailingWhitespace( | 1999 EXPECT_TRUE(CategoryFilter::IsEmptyOrContainsLeadingOrTrailingWhitespace( |
1996 "")); | 2000 "")); |
1997 EXPECT_FALSE(CategoryFilter::IsEmptyOrContainsLeadingOrTrailingWhitespace( | 2001 EXPECT_FALSE(CategoryFilter::IsEmptyOrContainsLeadingOrTrailingWhitespace( |
1998 "good_category")); | 2002 "good_category")); |
1999 } | 2003 } |
2000 | 2004 |
| 2005 |
| 2006 //TODO - move me |
| 2007 TEST_F(TraceEventTestFixture, TraceMemory) { |
| 2008 ManualTestSetUp(); |
| 2009 TraceMemoryStart(); |
| 2010 |
| 2011 scoped_ptr<char[]> not_in_trace(new char[10000]); |
| 2012 |
| 2013 TRACE_EVENT0("category_foo", "trace_foo"); |
| 2014 scoped_ptr<char[]> foo(new char[20000]); |
| 2015 |
| 2016 TRACE_EVENT0("category_bar", "trace_bar"); |
| 2017 scoped_ptr<char[]> bar(new char[30000]); |
| 2018 |
| 2019 TraceMemoryDump(); |
| 2020 TraceMemoryStop(); |
| 2021 } |
| 2022 |
2001 } // namespace debug | 2023 } // namespace debug |
2002 } // namespace base | 2024 } // namespace base |
OLD | NEW |