| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "content/browser/gpu/gpu_control_list.h" | 8 #include "gpu/config/gpu_control_list.h" |
| 9 #include "content/public/common/gpu_info.h" | 9 #include "gpu/config/gpu_info.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 const char kOsVersion[] = "10.6.4"; | 12 const char kOsVersion[] = "10.6.4"; |
| 13 const uint32 kIntelVendorId = 0x8086; | 13 const uint32 kIntelVendorId = 0x8086; |
| 14 const uint32 kIntelDeviceId = 0x0166; // 3rd Gen Core Graphics | 14 const uint32 kIntelDeviceId = 0x0166; // 3rd Gen Core Graphics |
| 15 const uint32 kNvidiaVendorId = 0x10de; | 15 const uint32 kNvidiaVendorId = 0x10de; |
| 16 const uint32 kNvidiaDeviceId = 0x0fd5; // GeForce GT 650M | 16 const uint32 kNvidiaDeviceId = 0x0fd5; // GeForce GT 650M |
| 17 | 17 |
| 18 #define LONG_STRING_CONST(...) #__VA_ARGS__ | 18 #define LONG_STRING_CONST(...) #__VA_ARGS__ |
| 19 | 19 |
| 20 #define EXPECT_EMPTY_SET(feature_set) EXPECT_EQ(0u, feature_set.size()) | 20 #define EXPECT_EMPTY_SET(feature_set) EXPECT_EQ(0u, feature_set.size()) |
| 21 #define EXPECT_SINGLE_FEATURE(feature_set, feature) \ | 21 #define EXPECT_SINGLE_FEATURE(feature_set, feature) \ |
| 22 EXPECT_TRUE(feature_set.size() == 1 && feature_set.count(feature) == 1) | 22 EXPECT_TRUE(feature_set.size() == 1 && feature_set.count(feature) == 1) |
| 23 | 23 |
| 24 namespace content { | 24 namespace gpu { |
| 25 | 25 |
| 26 enum TestFeatureType { | 26 enum TestFeatureType { |
| 27 TEST_FEATURE_0 = 1, | 27 TEST_FEATURE_0 = 1, |
| 28 TEST_FEATURE_1 = 1 << 2, | 28 TEST_FEATURE_1 = 1 << 2, |
| 29 TEST_FEATURE_2 = 1 << 3, | 29 TEST_FEATURE_2 = 1 << 3, |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 class GpuControlListTest : public testing::Test { | 32 class GpuControlListTest : public testing::Test { |
| 33 public: | 33 public: |
| 34 GpuControlListTest() { } | 34 GpuControlListTest() { } |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 gpu_info.gpu.vendor_id = kIntelVendorId; | 433 gpu_info.gpu.vendor_id = kIntelVendorId; |
| 434 | 434 |
| 435 scoped_ptr<GpuControlList> control_list(Create()); | 435 scoped_ptr<GpuControlList> control_list(Create()); |
| 436 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); | 436 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); |
| 437 std::set<int> features = control_list->MakeDecision( | 437 std::set<int> features = control_list->MakeDecision( |
| 438 GpuControlList::kOsLinux, kOsVersion, gpu_info); | 438 GpuControlList::kOsLinux, kOsVersion, gpu_info); |
| 439 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); | 439 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); |
| 440 EXPECT_FALSE(control_list->needs_more_info()); | 440 EXPECT_FALSE(control_list->needs_more_info()); |
| 441 } | 441 } |
| 442 | 442 |
| 443 } // namespace content | 443 } // namespace gpu |
| 444 | 444 |
| OLD | NEW |