Explicitly add python-numpy dependency to install-build-deps.
[chromium-blink-merge.git] / components / metrics / gpu / gpu_metrics_provider_unittest.cc
blob931b7315dd769f6d237a222429caeacccbc17c6e
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.
5 #include "components/metrics/gpu/gpu_metrics_provider.h"
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"
12 namespace metrics {
14 namespace {
16 const int kScreenWidth = 1024;
17 const int kScreenHeight = 768;
18 const int kScreenCount = 3;
19 const float kScreenScaleFactor = 2;
21 class TestGPUMetricsProvider : public GPUMetricsProvider {
22 public:
23 TestGPUMetricsProvider() {}
24 ~TestGPUMetricsProvider() override {}
26 private:
27 gfx::Size GetScreenSize() const override {
28 return gfx::Size(kScreenWidth, kScreenHeight);
31 float GetScreenDeviceScaleFactor() const override {
32 return kScreenScaleFactor;
35 int GetScreenCount() const override { return kScreenCount; }
37 DISALLOW_COPY_AND_ASSIGN(TestGPUMetricsProvider);
40 } // namespace
42 class GPUMetricsProviderTest : public testing::Test {
43 public:
44 GPUMetricsProviderTest() {}
45 ~GPUMetricsProviderTest() override {}
47 private:
48 DISALLOW_COPY_AND_ASSIGN(GPUMetricsProviderTest);
51 TEST_F(GPUMetricsProviderTest, ProvideSystemProfileMetrics) {
52 TestGPUMetricsProvider provider;
53 ChromeUserMetricsExtension uma_proto;
55 provider.ProvideSystemProfileMetrics(uma_proto.mutable_system_profile());
57 // Check that the system profile has the correct values set.
58 const SystemProfileProto::Hardware& hardware =
59 uma_proto.system_profile().hardware();
60 EXPECT_EQ(kScreenWidth, hardware.primary_screen_width());
61 EXPECT_EQ(kScreenHeight, hardware.primary_screen_height());
62 EXPECT_EQ(kScreenScaleFactor, hardware.primary_screen_scale_factor());
63 EXPECT_EQ(kScreenCount, hardware.screen_count());
66 } // namespace metrics