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

Side by Side Diff: third_party/WebKit/Source/platform/bindings/RuntimeCallStatsTest.cpp

Issue 2967013002: Be explicit about namespace testing to not mix it with blink::testing (Closed)
Patch Set: Dropped mojo parts that need another review. Created 3 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "platform/bindings/RuntimeCallStats.h" 5 #include "platform/bindings/RuntimeCallStats.h"
6 6
7 #include "platform/RuntimeEnabledFeatures.h" 7 #include "platform/RuntimeEnabledFeatures.h"
8 #include "platform/wtf/CurrentTime.h" 8 #include "platform/wtf/CurrentTime.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 namespace { 13 namespace {
14 14
15 TimeTicks ticks_; 15 TimeTicks ticks_;
16 16
17 void AdvanceClock(int milliseconds) { 17 void AdvanceClock(int milliseconds) {
18 ticks_ += TimeDelta::FromMilliseconds(milliseconds); 18 ticks_ += TimeDelta::FromMilliseconds(milliseconds);
19 } 19 }
20 20
21 RuntimeCallStats::CounterId test_counter_1_id = 21 RuntimeCallStats::CounterId test_counter_1_id =
22 RuntimeCallStats::CounterId::kTestCounter1; 22 RuntimeCallStats::CounterId::kTestCounter1;
23 RuntimeCallStats::CounterId test_counter_2_id = 23 RuntimeCallStats::CounterId test_counter_2_id =
24 RuntimeCallStats::CounterId::kTestCounter2; 24 RuntimeCallStats::CounterId::kTestCounter2;
25 25
26 } // namespace 26 } // namespace
27 27
28 class RuntimeCallStatsTest : public testing::Test { 28 class RuntimeCallStatsTest : public ::testing::Test {
29 public: 29 public:
30 void SetUp() override { 30 void SetUp() override {
31 // Add one millisecond because RuntimeCallTimer uses |start_ticks_| = 31 // Add one millisecond because RuntimeCallTimer uses |start_ticks_| =
32 // TimeTicks() to represent that the timer is not running. 32 // TimeTicks() to represent that the timer is not running.
33 ticks_ = WTF::TimeTicks() + TimeDelta::FromMilliseconds(1); 33 ticks_ = WTF::TimeTicks() + TimeDelta::FromMilliseconds(1);
34 original_time_function_ = 34 original_time_function_ =
35 SetTimeFunctionsForTesting([] { return ticks_.InSeconds(); }); 35 SetTimeFunctionsForTesting([] { return ticks_.InSeconds(); });
36 } 36 }
37 37
38 void TearDown() override { 38 void TearDown() override {
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 RUNTIME_CALL_TIMER_SCOPE_WITH_OPTIONAL_RCS(scope, &stats, 319 RUNTIME_CALL_TIMER_SCOPE_WITH_OPTIONAL_RCS(scope, &stats,
320 test_counter_1_id); 320 test_counter_1_id);
321 AdvanceClock(25); 321 AdvanceClock(25);
322 } 322 }
323 323
324 EXPECT_EQ(1ul, counter->GetCount()); 324 EXPECT_EQ(1ul, counter->GetCount());
325 EXPECT_EQ(25, counter->GetTime().InMilliseconds()); 325 EXPECT_EQ(25, counter->GetTime().InMilliseconds());
326 } 326 }
327 327
328 } // namespace blink 328 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698