| 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 // Test of classes in the tracked_objects.h classes. | 5 // Test of classes in the tracked_objects.h classes. |
| 6 | 6 |
| 7 #include "base/tracked_objects.h" | 7 #include "base/tracked_objects.h" |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace tracked_objects { | 14 namespace tracked_objects { |
| 15 | 15 |
| 16 class TrackedObjectsTest : public testing::Test { | 16 class TrackedObjectsTest : public testing::Test { |
| 17 protected: | 17 protected: |
| 18 TrackedObjectsTest() { | 18 TrackedObjectsTest() { |
| 19 // On entry, leak any database structures in case they are still in use by | 19 // On entry, leak any database structures in case they are still in use by |
| 20 // prior threads. | 20 // prior threads. |
| 21 ThreadData::ShutdownSingleThreadedCleanup(true); | 21 ThreadData::ShutdownSingleThreadedCleanup(true); |
| 22 } | 22 } |
| 23 | 23 |
| 24 ~TrackedObjectsTest() { | 24 virtual ~TrackedObjectsTest() { |
| 25 // We should not need to leak any structures we create, since we are | 25 // We should not need to leak any structures we create, since we are |
| 26 // single threaded, and carefully accounting for items. | 26 // single threaded, and carefully accounting for items. |
| 27 ThreadData::ShutdownSingleThreadedCleanup(false); | 27 ThreadData::ShutdownSingleThreadedCleanup(false); |
| 28 } | 28 } |
| 29 | 29 |
| 30 // Provide access, since this class is a friend of ThreadData. | 30 // Provide access, since this class is a friend of ThreadData. |
| 31 void ShutdownSingleThreadedCleanup(bool leak) { | 31 void ShutdownSingleThreadedCleanup(bool leak) { |
| 32 ThreadData::ShutdownSingleThreadedCleanup(leak); | 32 ThreadData::ShutdownSingleThreadedCleanup(leak); |
| 33 } | 33 } |
| 34 }; | 34 }; |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 "\"line_number\":999" | 813 "\"line_number\":999" |
| 814 "}" | 814 "}" |
| 815 "}" | 815 "}" |
| 816 "]" | 816 "]" |
| 817 "}"; | 817 "}"; |
| 818 EXPECT_EQ(one_line_result, json); | 818 EXPECT_EQ(one_line_result, json); |
| 819 } | 819 } |
| 820 | 820 |
| 821 | 821 |
| 822 } // namespace tracked_objects | 822 } // namespace tracked_objects |
| OLD | NEW |