OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/command_buffer/service/feature_info.h" | 5 #include "gpu/command_buffer/service/feature_info.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "gpu/command_buffer/service/gpu_service_test.h" |
10 #include "gpu/command_buffer/service/gpu_switches.h" | 11 #include "gpu/command_buffer/service/gpu_switches.h" |
11 #include "gpu/command_buffer/service/test_helper.h" | 12 #include "gpu/command_buffer/service/test_helper.h" |
12 #include "gpu/command_buffer/service/texture_manager.h" | 13 #include "gpu/command_buffer/service/texture_manager.h" |
13 #include "gpu/config/gpu_driver_bug_workaround_type.h" | 14 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "ui/gl/gl_implementation.h" | 16 #include "ui/gl/gl_implementation.h" |
16 #include "ui/gl/gl_mock.h" | 17 #include "ui/gl/gl_mock.h" |
17 | 18 |
18 using ::gfx::MockGLInterface; | |
19 using ::testing::_; | 19 using ::testing::_; |
20 using ::testing::DoAll; | 20 using ::testing::DoAll; |
21 using ::testing::HasSubstr; | 21 using ::testing::HasSubstr; |
22 using ::testing::InSequence; | 22 using ::testing::InSequence; |
23 using ::testing::MatcherCast; | 23 using ::testing::MatcherCast; |
24 using ::testing::Not; | 24 using ::testing::Not; |
25 using ::testing::Pointee; | 25 using ::testing::Pointee; |
26 using ::testing::Return; | 26 using ::testing::Return; |
27 using ::testing::SetArrayArgument; | 27 using ::testing::SetArrayArgument; |
28 using ::testing::SetArgumentPointee; | 28 using ::testing::SetArgumentPointee; |
29 using ::testing::StrEq; | 29 using ::testing::StrEq; |
30 using ::testing::StrictMock; | |
31 | 30 |
32 namespace gpu { | 31 namespace gpu { |
33 namespace gles2 { | 32 namespace gles2 { |
34 | 33 |
35 namespace { | 34 namespace { |
36 const char kGLRendererStringANGLE[] = "ANGLE (some renderer)"; | 35 const char kGLRendererStringANGLE[] = "ANGLE (some renderer)"; |
37 } // anonymous namespace | 36 } // anonymous namespace |
38 | 37 |
39 class FeatureInfoTest : public testing::Test { | 38 class FeatureInfoTest : public GpuServiceTest { |
40 public: | 39 public: |
41 FeatureInfoTest() { | 40 FeatureInfoTest() { |
42 } | 41 } |
43 | 42 |
44 void SetupInitExpectations(const char* extensions) { | 43 void SetupInitExpectations(const char* extensions) { |
45 SetupInitExpectationsWithGLVersion(extensions, "", ""); | 44 SetupInitExpectationsWithGLVersion(extensions, "", ""); |
46 } | 45 } |
47 | 46 |
48 void SetupInitExpectationsWithGLVersion( | 47 void SetupInitExpectationsWithGLVersion( |
49 const char* extensions, const char* renderer, const char* version) { | 48 const char* extensions, const char* renderer, const char* version) { |
(...skipping 13 matching lines...) Expand all Loading... |
63 gl_.get(), extensions, "", ""); | 62 gl_.get(), extensions, "", ""); |
64 info_ = new FeatureInfo(command_line); | 63 info_ = new FeatureInfo(command_line); |
65 info_->Initialize(); | 64 info_->Initialize(); |
66 } | 65 } |
67 | 66 |
68 void SetupWithoutInit() { | 67 void SetupWithoutInit() { |
69 info_ = new FeatureInfo(); | 68 info_ = new FeatureInfo(); |
70 } | 69 } |
71 | 70 |
72 protected: | 71 protected: |
73 virtual void SetUp() { | 72 virtual void TearDown() { |
74 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); | 73 info_ = NULL; |
75 ::gfx::MockGLInterface::SetGLInterface(gl_.get()); | 74 GpuServiceTest::TearDown(); |
76 } | 75 } |
77 | 76 |
78 virtual void TearDown() { | |
79 info_ = NULL; | |
80 ::gfx::MockGLInterface::SetGLInterface(NULL); | |
81 gl_.reset(); | |
82 } | |
83 | |
84 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; | |
85 scoped_refptr<FeatureInfo> info_; | 77 scoped_refptr<FeatureInfo> info_; |
86 }; | 78 }; |
87 | 79 |
88 namespace { | 80 namespace { |
89 | 81 |
90 struct FormatInfo { | 82 struct FormatInfo { |
91 GLenum format; | 83 GLenum format; |
92 const GLenum* types; | 84 const GLenum* types; |
93 size_t count; | 85 size_t count; |
94 }; | 86 }; |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 base::IntToString(gpu::MAX_TEXTURE_SIZE_LIMIT_4096)); | 1038 base::IntToString(gpu::MAX_TEXTURE_SIZE_LIMIT_4096)); |
1047 // Workarounds should get parsed without the need for a context. | 1039 // Workarounds should get parsed without the need for a context. |
1048 SetupWithCommandLine(command_line); | 1040 SetupWithCommandLine(command_line); |
1049 EXPECT_TRUE(info_->workarounds().exit_on_context_lost); | 1041 EXPECT_TRUE(info_->workarounds().exit_on_context_lost); |
1050 EXPECT_EQ(1024, info_->workarounds().max_cube_map_texture_size); | 1042 EXPECT_EQ(1024, info_->workarounds().max_cube_map_texture_size); |
1051 EXPECT_EQ(4096, info_->workarounds().max_texture_size); | 1043 EXPECT_EQ(4096, info_->workarounds().max_texture_size); |
1052 } | 1044 } |
1053 | 1045 |
1054 } // namespace gles2 | 1046 } // namespace gles2 |
1055 } // namespace gpu | 1047 } // namespace gpu |
OLD | NEW |