OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/metrics/gpu_metrics_provider.h" | |
6 | |
7 #include "base/basictypes.h" | |
8 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" | |
9 #include "testing/gtest/include/gtest/gtest.h" | |
10 #include "ui/gfx/size.h" | |
11 | |
12 namespace { | |
13 | |
14 const int kScreenWidth = 1024; | |
15 const int kScreenHeight = 768; | |
16 const int kScreenCount = 3; | |
17 const float kScreenScaleFactor = 2; | |
18 | |
19 class TestGPUMetricsProvider : public GPUMetricsProvider { | |
20 public: | |
21 TestGPUMetricsProvider() {} | |
22 | |
Alexei Svitkine (slow)
2014/05/20 14:16:37
Nit: Remove blank line.
blundell
2014/05/20 14:20:49
Done.
| |
23 virtual ~TestGPUMetricsProvider() {} | |
24 | |
25 private: | |
26 virtual gfx::Size GetScreenSize() const OVERRIDE { | |
27 return gfx::Size(kScreenWidth, kScreenHeight); | |
28 } | |
29 | |
30 virtual float GetScreenDeviceScaleFactor() const OVERRIDE { | |
31 return kScreenScaleFactor; | |
32 } | |
33 | |
34 virtual int GetScreenCount() const OVERRIDE { | |
35 return kScreenCount; | |
36 } | |
37 }; | |
Alexei Svitkine (slow)
2014/05/20 14:16:37
Nit: Add DISALLOW_COPY_AND_ASSIGN().
blundell
2014/05/20 14:20:49
Done.
| |
38 | |
39 } // namespace | |
40 | |
41 class GPUMetricsProviderTest : public testing::Test { | |
42 public: | |
43 GPUMetricsProviderTest() {} | |
44 virtual ~GPUMetricsProviderTest() {} | |
45 | |
46 DISALLOW_COPY_AND_ASSIGN(GPUMetricsProviderTest); | |
Alexei Svitkine (slow)
2014/05/20 14:16:37
Nit: Put this in the private section.
blundell
2014/05/20 14:20:49
Done.
| |
47 }; | |
48 | |
49 TEST_F(GPUMetricsProviderTest, ProvideSystemProfileMetrics) { | |
50 TestGPUMetricsProvider provider; | |
51 metrics::ChromeUserMetricsExtension uma_proto; | |
52 | |
53 provider.ProvideSystemProfileMetrics(uma_proto.mutable_system_profile()); | |
54 | |
55 // Check that the system profile has the correct values set. | |
56 const metrics::SystemProfileProto::Hardware& hardware = | |
57 uma_proto.system_profile().hardware(); | |
58 EXPECT_EQ(kScreenWidth, hardware.primary_screen_width()); | |
59 EXPECT_EQ(kScreenHeight, hardware.primary_screen_height()); | |
60 EXPECT_EQ(kScreenScaleFactor, hardware.primary_screen_scale_factor()); | |
61 EXPECT_EQ(kScreenCount, hardware.screen_count()); | |
62 } | |
OLD | NEW |