OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/base_paths.h" |
| 6 #include "base/file_util.h" |
| 7 #include "base/files/file_path.h" |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/path_service.h" |
| 10 #include "content/browser/gpu/gpu_driver_bug_list.h" |
| 11 #include "content/public/common/gpu_info.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 |
| 14 const char kOsVersion[] = "10.6.4"; |
| 15 |
| 16 namespace content { |
| 17 |
| 18 class GpuDriverBugListTest : public testing::Test { |
| 19 public: |
| 20 GpuDriverBugListTest() { } |
| 21 |
| 22 virtual ~GpuDriverBugListTest() { } |
| 23 |
| 24 const GPUInfo& gpu_info() const { |
| 25 return gpu_info_; |
| 26 } |
| 27 |
| 28 protected: |
| 29 virtual void SetUp() { |
| 30 gpu_info_.gpu.vendor_id = 0x10de; |
| 31 gpu_info_.gpu.device_id = 0x0640; |
| 32 gpu_info_.driver_vendor = "NVIDIA"; |
| 33 gpu_info_.driver_version = "1.6.18"; |
| 34 gpu_info_.driver_date = "7-14-2009"; |
| 35 gpu_info_.machine_model = "MacBookPro 7.1"; |
| 36 gpu_info_.gl_vendor = "NVIDIA Corporation"; |
| 37 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; |
| 38 gpu_info_.performance_stats.graphics = 5.0; |
| 39 gpu_info_.performance_stats.gaming = 5.0; |
| 40 gpu_info_.performance_stats.overall = 5.0; |
| 41 } |
| 42 |
| 43 virtual void TearDown() { |
| 44 } |
| 45 |
| 46 private: |
| 47 GPUInfo gpu_info_; |
| 48 }; |
| 49 |
| 50 #if !defined(OS_ANDROID) |
| 51 TEST_F(GpuDriverBugListTest, CurrentDriverBugListValidation) { |
| 52 base::FilePath data_file; |
| 53 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_file)); |
| 54 data_file = |
| 55 data_file.Append(FILE_PATH_LITERAL("content")) |
| 56 .Append(FILE_PATH_LITERAL("browser")) |
| 57 .Append(FILE_PATH_LITERAL("gpu")) |
| 58 .Append(FILE_PATH_LITERAL("gpu_driver_bug_list.json")); |
| 59 ASSERT_TRUE(file_util::PathExists(data_file)); |
| 60 int64 data_file_size64 = 0; |
| 61 ASSERT_TRUE(file_util::GetFileSize(data_file, &data_file_size64)); |
| 62 int data_file_size = static_cast<int>(data_file_size64); |
| 63 scoped_array<char> data(new char[data_file_size]); |
| 64 ASSERT_EQ(data_file_size, |
| 65 file_util::ReadFile(data_file, data.get(), data_file_size)); |
| 66 std::string json_string(data.get(), data_file_size); |
| 67 scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); |
| 68 EXPECT_TRUE(list->LoadList(json_string, GpuControlList::kAllOs)); |
| 69 EXPECT_FALSE(list->contains_unknown_fields()); |
| 70 } |
| 71 #endif |
| 72 |
| 73 } // namespace content |
| 74 |
OLD | NEW |