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