| OLD | NEW |
| 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/scoped_ptr.h" | 6 #include "base/scoped_ptr.h" |
| 7 #include "chrome/common/gpu_info.h" | 7 #include "chrome/common/gpu_info.h" |
| 8 #include "chrome/common/gpu_messages.h" | 8 #include "chrome/common/gpu_messages.h" |
| 9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
| 10 #include "ipc/ipc_message_utils.h" | 10 #include "ipc/ipc_message_utils.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 // Test GPUInfo serialization | 13 // Test GPUInfo serialization |
| 14 TEST(GPUIPCMessageTest, GPUInfo) { | 14 TEST(GPUIPCMessageTest, GPUInfo) { |
| 15 GPUInfo input; | 15 GPUInfo input; |
| 16 // Test variables taken from Lenovo T61 | 16 // Test variables taken from Lenovo T61 |
| 17 input.SetGraphicsInfo(0x10de, 0x429, L"6.14.11.7715", | 17 input.SetGraphicsInfo(0x10de, 0x429, L"6.14.11.7715", |
| 18 0xffff0300, 0xfffe0300); | 18 0xffff0300, 0xfffe0300, |
| 19 0x00010005); |
| 19 | 20 |
| 20 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); | 21 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); |
| 21 IPC::WriteParam(&msg, input); | 22 IPC::WriteParam(&msg, input); |
| 22 | 23 |
| 23 GPUInfo output; | 24 GPUInfo output; |
| 24 void* iter = NULL; | 25 void* iter = NULL; |
| 25 EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output)); | 26 EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output)); |
| 26 EXPECT_EQ(input.vendor_id(), output.vendor_id()); | 27 EXPECT_EQ(input.vendor_id(), output.vendor_id()); |
| 27 EXPECT_EQ(input.device_id(), output.device_id()); | 28 EXPECT_EQ(input.device_id(), output.device_id()); |
| 28 EXPECT_EQ(input.driver_version(), output.driver_version()); | 29 EXPECT_EQ(input.driver_version(), output.driver_version()); |
| 29 EXPECT_EQ(input.pixel_shader_version(), output.pixel_shader_version()); | 30 EXPECT_EQ(input.pixel_shader_version(), output.pixel_shader_version()); |
| 30 EXPECT_EQ(input.vertex_shader_version(), output.vertex_shader_version()); | 31 EXPECT_EQ(input.vertex_shader_version(), output.vertex_shader_version()); |
| 32 EXPECT_EQ(input.gl_version(), output.gl_version()); |
| 31 | 33 |
| 32 std::string log_message; | 34 std::string log_message; |
| 33 IPC::LogParam(output, &log_message); | 35 IPC::LogParam(output, &log_message); |
| 34 EXPECT_STREQ("<GPUInfo> 10de 429 6.14.11.7715", log_message.c_str()); | 36 EXPECT_STREQ("<GPUInfo> 10de 429 6.14.11.7715", log_message.c_str()); |
| 35 } | 37 } |
| OLD | NEW |