| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 8 #include "gpu/config/gpu_control_list.h" | 10 #include "gpu/config/gpu_control_list.h" |
| 9 #include "gpu/config/gpu_info.h" | 11 #include "gpu/config/gpu_info.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 13 |
| 12 #define LONG_STRING_CONST(...) #__VA_ARGS__ | 14 #define LONG_STRING_CONST(...) #__VA_ARGS__ |
| 13 | 15 |
| 14 namespace gpu { | 16 namespace gpu { |
| 15 | 17 |
| 16 enum TestFeatureType { | 18 enum TestFeatureType { |
| 17 TEST_FEATURE_0 = 0, | 19 TEST_FEATURE_0 = 0, |
| 18 TEST_FEATURE_1, | 20 TEST_FEATURE_1, |
| 19 TEST_FEATURE_2 | 21 TEST_FEATURE_2 |
| 20 }; | 22 }; |
| 21 | 23 |
| 22 class GpuControlListEntryTest : public testing::Test { | 24 class GpuControlListEntryTest : public testing::Test { |
| 23 public: | 25 public: |
| 24 GpuControlListEntryTest() { } | 26 GpuControlListEntryTest() { } |
| 25 ~GpuControlListEntryTest() override {} | 27 ~GpuControlListEntryTest() override {} |
| 26 | 28 |
| 27 const GPUInfo& gpu_info() const { | 29 const GPUInfo& gpu_info() const { |
| 28 return gpu_info_; | 30 return gpu_info_; |
| 29 } | 31 } |
| 30 | 32 |
| 31 typedef GpuControlList::ScopedGpuControlListEntry ScopedEntry; | 33 typedef GpuControlList::ScopedGpuControlListEntry ScopedEntry; |
| 32 | 34 |
| 33 static ScopedEntry GetEntryFromString( | 35 static ScopedEntry GetEntryFromString( |
| 34 const std::string& json, bool supports_feature_type_all) { | 36 const std::string& json, bool supports_feature_type_all) { |
| 35 scoped_ptr<base::Value> root = base::JSONReader::Read(json); | 37 std::unique_ptr<base::Value> root = base::JSONReader::Read(json); |
| 36 base::DictionaryValue* value = NULL; | 38 base::DictionaryValue* value = NULL; |
| 37 if (!root || !root->GetAsDictionary(&value)) | 39 if (!root || !root->GetAsDictionary(&value)) |
| 38 return NULL; | 40 return NULL; |
| 39 | 41 |
| 40 GpuControlList::FeatureMap feature_map; | 42 GpuControlList::FeatureMap feature_map; |
| 41 feature_map["test_feature_0"] = TEST_FEATURE_0; | 43 feature_map["test_feature_0"] = TEST_FEATURE_0; |
| 42 feature_map["test_feature_1"] = TEST_FEATURE_1; | 44 feature_map["test_feature_1"] = TEST_FEATURE_1; |
| 43 feature_map["test_feature_2"] = TEST_FEATURE_2; | 45 feature_map["test_feature_2"] = TEST_FEATURE_2; |
| 44 | 46 |
| 45 return GpuControlList::GpuControlListEntry::GetEntryFromValue( | 47 return GpuControlList::GpuControlListEntry::GetEntryFromValue( |
| (...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 EXPECT_TRUE(entry->Contains(GpuControlList::kOsLinux, | 1269 EXPECT_TRUE(entry->Contains(GpuControlList::kOsLinux, |
| 1268 "3.13.0-63-generic", | 1270 "3.13.0-63-generic", |
| 1269 gpu_info)); | 1271 gpu_info)); |
| 1270 EXPECT_FALSE(entry->Contains(GpuControlList::kOsLinux, | 1272 EXPECT_FALSE(entry->Contains(GpuControlList::kOsLinux, |
| 1271 "3.19.2-1-generic", | 1273 "3.19.2-1-generic", |
| 1272 gpu_info)); | 1274 gpu_info)); |
| 1273 } | 1275 } |
| 1274 | 1276 |
| 1275 } // namespace gpu | 1277 } // namespace gpu |
| 1276 | 1278 |
| OLD | NEW |