| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/multiprocess_test.h" | 5 #include "base/multiprocess_test.h" |
| 6 #include "base/platform_thread.h" | 6 #include "base/platform_thread.h" |
| 7 #include "base/stats_table.h" | 7 #include "base/stats_table.h" |
| 8 #include "base/stats_counters.h" | 8 #include "base/stats_counters.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
| 13 #include <process.h> | 13 #include <process.h> |
| 14 #include <windows.h> | 14 #include <windows.h> |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 using base::TimeTicks; |
| 18 |
| 17 namespace { | 19 namespace { |
| 18 class StatsTableTest : public MultiProcessTest { | 20 class StatsTableTest : public MultiProcessTest { |
| 19 }; | 21 }; |
| 20 } | 22 } |
| 21 | 23 |
| 22 // Open a StatsTable and verify that we can write to each of the | 24 // Open a StatsTable and verify that we can write to each of the |
| 23 // locations in the table. | 25 // locations in the table. |
| 24 TEST_F(StatsTableTest, VerifySlots) { | 26 TEST_F(StatsTableTest, VerifySlots) { |
| 25 const std::wstring kTableName = L"VerifySlotsStatTable"; | 27 const std::wstring kTableName = L"VerifySlotsStatTable"; |
| 26 const int kMaxThreads = 1; | 28 const int kMaxThreads = 1; |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 { | 372 { |
| 371 StatsScope<StatsCounterTimer> timer(foo); | 373 StatsScope<StatsCounterTimer> timer(foo); |
| 372 StatsScope<StatsRate> timer2(bar); | 374 StatsScope<StatsRate> timer2(bar); |
| 373 PlatformThread::Sleep(500); | 375 PlatformThread::Sleep(500); |
| 374 } | 376 } |
| 375 EXPECT_LE(1000, table.GetCounterValue(L"t:foo")); | 377 EXPECT_LE(1000, table.GetCounterValue(L"t:foo")); |
| 376 EXPECT_LE(1000, table.GetCounterValue(L"t:bar")); | 378 EXPECT_LE(1000, table.GetCounterValue(L"t:bar")); |
| 377 EXPECT_EQ(2, table.GetCounterValue(L"c:bar")); | 379 EXPECT_EQ(2, table.GetCounterValue(L"c:bar")); |
| 378 } | 380 } |
| 379 | 381 |
| OLD | NEW |