| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "components/metrics/gpu/gpu_metrics_provider.h" | 5 #include "components/metrics/gpu/gpu_metrics_provider.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" | 8 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/gfx/size.h" | 10 #include "ui/gfx/size.h" |
| 11 | 11 |
| 12 namespace metrics { | 12 namespace metrics { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 const int kScreenWidth = 1024; | 16 const int kScreenWidth = 1024; |
| 17 const int kScreenHeight = 768; | 17 const int kScreenHeight = 768; |
| 18 const int kScreenCount = 3; | 18 const int kScreenCount = 3; |
| 19 const float kScreenScaleFactor = 2; | 19 const float kScreenScaleFactor = 2; |
| 20 | 20 |
| 21 class TestGPUMetricsProvider : public GPUMetricsProvider { | 21 class TestGPUMetricsProvider : public GPUMetricsProvider { |
| 22 public: | 22 public: |
| 23 TestGPUMetricsProvider() {} | 23 TestGPUMetricsProvider() {} |
| 24 virtual ~TestGPUMetricsProvider() {} | 24 ~TestGPUMetricsProvider() override {} |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 virtual gfx::Size GetScreenSize() const override { | 27 gfx::Size GetScreenSize() const override { |
| 28 return gfx::Size(kScreenWidth, kScreenHeight); | 28 return gfx::Size(kScreenWidth, kScreenHeight); |
| 29 } | 29 } |
| 30 | 30 |
| 31 virtual float GetScreenDeviceScaleFactor() const override { | 31 float GetScreenDeviceScaleFactor() const override { |
| 32 return kScreenScaleFactor; | 32 return kScreenScaleFactor; |
| 33 } | 33 } |
| 34 | 34 |
| 35 virtual int GetScreenCount() const override { | 35 int GetScreenCount() const override { return kScreenCount; } |
| 36 return kScreenCount; | |
| 37 } | |
| 38 | 36 |
| 39 DISALLOW_COPY_AND_ASSIGN(TestGPUMetricsProvider); | 37 DISALLOW_COPY_AND_ASSIGN(TestGPUMetricsProvider); |
| 40 }; | 38 }; |
| 41 | 39 |
| 42 } // namespace | 40 } // namespace |
| 43 | 41 |
| 44 class GPUMetricsProviderTest : public testing::Test { | 42 class GPUMetricsProviderTest : public testing::Test { |
| 45 public: | 43 public: |
| 46 GPUMetricsProviderTest() {} | 44 GPUMetricsProviderTest() {} |
| 47 virtual ~GPUMetricsProviderTest() {} | 45 virtual ~GPUMetricsProviderTest() {} |
| (...skipping 11 matching lines...) Expand all Loading... |
| 59 // Check that the system profile has the correct values set. | 57 // Check that the system profile has the correct values set. |
| 60 const metrics::SystemProfileProto::Hardware& hardware = | 58 const metrics::SystemProfileProto::Hardware& hardware = |
| 61 uma_proto.system_profile().hardware(); | 59 uma_proto.system_profile().hardware(); |
| 62 EXPECT_EQ(kScreenWidth, hardware.primary_screen_width()); | 60 EXPECT_EQ(kScreenWidth, hardware.primary_screen_width()); |
| 63 EXPECT_EQ(kScreenHeight, hardware.primary_screen_height()); | 61 EXPECT_EQ(kScreenHeight, hardware.primary_screen_height()); |
| 64 EXPECT_EQ(kScreenScaleFactor, hardware.primary_screen_scale_factor()); | 62 EXPECT_EQ(kScreenScaleFactor, hardware.primary_screen_scale_factor()); |
| 65 EXPECT_EQ(kScreenCount, hardware.screen_count()); | 63 EXPECT_EQ(kScreenCount, hardware.screen_count()); |
| 66 } | 64 } |
| 67 | 65 |
| 68 } // namespace metrics | 66 } // namespace metrics |
| OLD | NEW |