diff --git a/gpu/BUILD.gn b/gpu/BUILD.gn index 92da9bf..e18d0b5 100644 --- a/gpu/BUILD.gn +++ b/gpu/BUILD.gn
@@ -355,7 +355,13 @@ } if (is_android) { - sources += [ "ipc/client/gpu_memory_buffer_impl_android_hardware_buffer_unittest.cc" ] + sources += [ + "ipc/client/gpu_memory_buffer_impl_android_hardware_buffer_unittest.cc", + ] + } + + if (is_posix && !is_mac) { + sources += [ "command_buffer/service/gpu_fence_manager_unittest.cc" ] } # TODO(geofflang): Run passthrough command decoder unittests on more platforms
diff --git a/gpu/command_buffer/service/gpu_fence_manager_unittest.cc b/gpu/command_buffer/service/gpu_fence_manager_unittest.cc new file mode 100644 index 0000000..6daaf9b --- /dev/null +++ b/gpu/command_buffer/service/gpu_fence_manager_unittest.cc
@@ -0,0 +1,223 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "gpu/command_buffer/service/gpu_fence_manager.h" + +#include "base/bind.h" +#include "base/bind_helpers.h" +#include "build/build_config.h" +#include "gpu/command_buffer/service/error_state_mock.h" +#include "gpu/command_buffer/service/feature_info.h" +#include "gpu/command_buffer/service/gpu_service_test.h" +#include "gpu/command_buffer/service/test_helper.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/gfx/gpu_fence.h" +#include "ui/gfx/gpu_fence_handle.h" +#include "ui/gl/egl_mock.h" +#include "ui/gl/gl_egl_api_implementation.h" +#include "ui/gl/gl_surface_egl.h" + +#if defined(OS_POSIX) +#include <unistd.h> +#endif + +using ::testing::Return; +using ::testing::SetArgPointee; +using ::testing::_; + +namespace gpu { +namespace gles2 { + +class GpuFenceManagerTest : public GpuServiceTest { + public: + GpuFenceManagerTest() { + GpuDriverBugWorkarounds gpu_driver_bug_workaround; + feature_info_ = new FeatureInfo(gpu_driver_bug_workaround); + } + + ~GpuFenceManagerTest() override {} + + protected: + void SetUp() override { + GpuServiceTest::SetUp(); + SetupMockEGL("EGL_ANDROID_native_fence_sync EGL_KHR_wait_sync"); + SetupFeatureInfo("", "OpenGL ES 2.0", CONTEXT_TYPE_OPENGLES2); + error_state_.reset(new ::testing::StrictMock<MockErrorState>()); + manager_.reset(new GpuFenceManager()); + } + + void TearDown() override { + manager_->Destroy(false); + manager_.reset(); + GpuServiceTest::TearDown(); + TeardownMockEGL(); + } + + void SetupMockEGL(const char* extensions) { + gl::SetGLGetProcAddressProc(gl::MockEGLInterface::GetGLProcAddress); + egl_.reset(new ::testing::NiceMock<::gl::MockEGLInterface>()); + ::gl::MockEGLInterface::SetEGLInterface(egl_.get()); + + const EGLDisplay kDummyDisplay = reinterpret_cast<EGLDisplay>(0x1001); + ON_CALL(*egl_, QueryString(_, EGL_EXTENSIONS)) + .WillByDefault(Return(extensions)); + ON_CALL(*egl_, GetCurrentDisplay()).WillByDefault(Return(kDummyDisplay)); + ON_CALL(*egl_, GetDisplay(_)).WillByDefault(Return(kDummyDisplay)); + ON_CALL(*egl_, Initialize(_, _, _)).WillByDefault(Return(true)); + ON_CALL(*egl_, Terminate(_)).WillByDefault(Return(true)); + + gl::ClearBindingsEGL(); + gl::InitializeStaticGLBindingsEGL(); + gl::GLSurfaceEGL::InitializeOneOffForTesting(); + } + + void TeardownMockEGL() { egl_.reset(); } + + void SetupFeatureInfo(const char* gl_extensions, + const char* gl_version, + ContextType context_type) { + TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( + gl_.get(), gl_extensions, "", gl_version, context_type); + feature_info_->InitializeForTesting(context_type); + ASSERT_TRUE(feature_info_->context_type() == context_type); + } + + scoped_refptr<FeatureInfo> feature_info_; + std::unique_ptr<GpuFenceManager> manager_; + std::unique_ptr<MockErrorState> error_state_; + std::unique_ptr<::testing::NiceMock<::gl::MockEGLInterface>> egl_; +}; + +TEST_F(GpuFenceManagerTest, Basic) { + const GLuint kClient1Id = 1; + const GLuint kClient2Id = 2; + const EGLSyncKHR kDummySync = reinterpret_cast<EGLSyncKHR>(0x2001); + + // Sanity check that our client IDs are invalid at start. + EXPECT_FALSE(manager_->IsValidGpuFence(kClient1Id)); + EXPECT_FALSE(manager_->IsValidGpuFence(kClient2Id)); + + // Creating a new fence creates an underlying native sync object. + EXPECT_CALL(*egl_, CreateSyncKHR(_, EGL_SYNC_NATIVE_FENCE_ANDROID, nullptr)) + .Times(1) + .WillOnce(Return(kDummySync)) + .RetiresOnSaturation(); + EXPECT_CALL(*gl_, Flush()).Times(1).RetiresOnSaturation(); + EXPECT_TRUE(manager_->CreateGpuFence(kClient1Id)); + EXPECT_TRUE(manager_->IsValidGpuFence(kClient1Id)); + + // Try a server wait on it. + EXPECT_CALL(*egl_, WaitSyncKHR(_, kDummySync, _)) + .Times(1) + .WillOnce(Return(EGL_TRUE)) + .RetiresOnSaturation(); + EXPECT_TRUE(manager_->GpuFenceServerWait(kClient1Id)); + + // Removing the fence marks it invalid. + EXPECT_CALL(*egl_, DestroySyncKHR(_, kDummySync)) + .Times(1) + .RetiresOnSaturation(); + EXPECT_TRUE(manager_->RemoveGpuFence(kClient1Id)); + EXPECT_FALSE(manager_->IsValidGpuFence(kClient1Id)); + + // Removing a non-existent fence does not crash. + EXPECT_FALSE(manager_->RemoveGpuFence(kClient2Id)); +} + +TEST_F(GpuFenceManagerTest, Destruction) { + const GLuint kClient1Id = 1; + const EGLSyncKHR kDummySync = reinterpret_cast<EGLSyncKHR>(0x2001); + + // Sanity check that our client IDs are invalid at start. + EXPECT_FALSE(manager_->IsValidGpuFence(kClient1Id)); + + // Create a fence object. + EXPECT_CALL(*egl_, CreateSyncKHR(_, _, _)).WillOnce(Return(kDummySync)); + EXPECT_CALL(*gl_, Flush()).Times(1).RetiresOnSaturation(); + EXPECT_TRUE(manager_->CreateGpuFence(kClient1Id)); + EXPECT_TRUE(manager_->IsValidGpuFence(kClient1Id)); + + // Destroying the manager destroys any pending sync objects. + EXPECT_CALL(*egl_, DestroySyncKHR(_, kDummySync)) + .Times(1) + .RetiresOnSaturation(); + manager_->Destroy(true); +} + +#if defined(OS_POSIX) + +TEST_F(GpuFenceManagerTest, GetGpuFence) { + const GLuint kClient1Id = 1; + const EGLSyncKHR kDummySync = reinterpret_cast<EGLSyncKHR>(0x2001); + const EGLint kFenceFD = dup(1); + + // Creating a new fence creates an underlying native sync object. + EXPECT_CALL(*egl_, CreateSyncKHR(_, EGL_SYNC_NATIVE_FENCE_ANDROID, nullptr)) + .Times(1) + .WillOnce(Return(kDummySync)) + .RetiresOnSaturation(); + EXPECT_CALL(*gl_, Flush()).Times(1).RetiresOnSaturation(); + EXPECT_TRUE(manager_->CreateGpuFence(kClient1Id)); + EXPECT_TRUE(manager_->IsValidGpuFence(kClient1Id)); + + // Get a GpuFence and its GpuFenceHandle. + + // We use a dup'ed STDOUT as the file descriptor for testing. Since + // it will be closed on GpuFence destruction, only return it one time. + EXPECT_CALL(*egl_, DupNativeFenceFDANDROID(_, kDummySync)) + .Times(1) + .WillOnce(Return(kFenceFD)) + .RetiresOnSaturation(); + std::unique_ptr<gfx::GpuFence> gpu_fence = manager_->GetGpuFence(kClient1Id); + EXPECT_TRUE(gpu_fence); + gfx::GpuFenceHandle handle = gpu_fence->GetGpuFenceHandle(); + + EXPECT_EQ(handle.type, gfx::GpuFenceHandleType::kAndroidNativeFenceSync); + EXPECT_EQ(handle.native_fd.fd, kFenceFD); + + // Removing the fence marks it invalid. + EXPECT_CALL(*egl_, DestroySyncKHR(_, kDummySync)) + .Times(1) + .RetiresOnSaturation(); + EXPECT_TRUE(manager_->RemoveGpuFence(kClient1Id)); +} + +TEST_F(GpuFenceManagerTest, Duplication) { + const GLuint kClient1Id = 1; + const EGLSyncKHR kDummySync = reinterpret_cast<EGLSyncKHR>(0x2001); + const EGLint kFenceFD = dup(1); + + // Sanity check that our client IDs are invalid at start. + EXPECT_FALSE(manager_->IsValidGpuFence(kClient1Id)); + + // Create a handle. + gfx::GpuFenceHandle handle; + handle.type = gfx::GpuFenceHandleType::kAndroidNativeFenceSync; + handle.native_fd = base::FileDescriptor(kFenceFD, true); + + // Create a duplicate fence object from it. + EXPECT_CALL(*egl_, CreateSyncKHR(_, EGL_SYNC_NATIVE_FENCE_ANDROID, _)) + .Times(1) + .WillOnce(Return(kDummySync)) + .RetiresOnSaturation(); + EXPECT_CALL(*gl_, Flush()).Times(1).RetiresOnSaturation(); + EXPECT_TRUE(manager_->CreateGpuFenceFromHandle(kClient1Id, handle)); + EXPECT_TRUE(manager_->IsValidGpuFence(kClient1Id)); + + // Try a server wait on it. + EXPECT_CALL(*egl_, WaitSyncKHR(_, kDummySync, _)) + .Times(1) + .WillOnce(Return(EGL_TRUE)) + .RetiresOnSaturation(); + EXPECT_TRUE(manager_->GpuFenceServerWait(kClient1Id)); + + // Cleanup. + EXPECT_TRUE(manager_->RemoveGpuFence(kClient1Id)); + EXPECT_FALSE(manager_->IsValidGpuFence(kClient1Id)); +} + +#endif // OS_POSIX + +} // namespace gles2 +} // namespace gpu
diff --git a/testing/buildbot/chromium.angle.json b/testing/buildbot/chromium.angle.json index 10b345e2..17c766c8 100644 --- a/testing/buildbot/chromium.angle.json +++ b/testing/buildbot/chromium.angle.json
@@ -1,4 +1,6 @@ { + "AAAAA1 AUTOGENERATED FILE DO NOT EDIT": {}, + "AAAAA2 See generate_buildbot_json.py to make changes": {}, "Linux Tests (ANGLE)": { "gtest_tests": [ {
diff --git a/testing/buildbot/chromium.goma.json b/testing/buildbot/chromium.goma.json index d8c94d2d..f5b960b 100644 --- a/testing/buildbot/chromium.goma.json +++ b/testing/buildbot/chromium.goma.json
@@ -1,4 +1,6 @@ { + "AAAAA1 AUTOGENERATED FILE DO NOT EDIT": {}, + "AAAAA2 See generate_buildbot_json.py to make changes": {}, "Chromium Linux Goma GCE Staging": { "additional_compile_targets": [ "all"
diff --git a/testing/buildbot/chromium.webkit.json b/testing/buildbot/chromium.webkit.json index 5ccf8fa8..f24443a 100644 --- a/testing/buildbot/chromium.webkit.json +++ b/testing/buildbot/chromium.webkit.json
@@ -1,4 +1,6 @@ { + "AAAAA1 AUTOGENERATED FILE DO NOT EDIT": {}, + "AAAAA2 See generate_buildbot_json.py to make changes": {}, "WebKit Linux Trusty": { "gtest_tests": [ { @@ -299,15 +301,27 @@ "WebKit Mac10.10": { "gtest_tests": [ { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "blink_heap_unittests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "blink_platform_unittests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "webkit_unit_tests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "wtf_unittests" } ], @@ -348,15 +362,27 @@ "WebKit Mac10.11": { "gtest_tests": [ { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "blink_heap_unittests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "blink_platform_unittests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "webkit_unit_tests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "wtf_unittests" } ], @@ -397,15 +423,27 @@ "WebKit Mac10.11 (dbg)": { "gtest_tests": [ { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "blink_heap_unittests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "blink_platform_unittests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "webkit_unit_tests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "wtf_unittests" } ], @@ -449,15 +487,27 @@ "WebKit Mac10.11 (retina)": { "gtest_tests": [ { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "blink_heap_unittests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "blink_platform_unittests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "webkit_unit_tests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "wtf_unittests" } ], @@ -500,15 +550,27 @@ "WebKit Mac10.12": { "gtest_tests": [ { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "blink_heap_unittests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "blink_platform_unittests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "webkit_unit_tests" }, { + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "wtf_unittests" } ], @@ -664,7 +726,6 @@ ] }, "WebKit Win7": { - "gtest_tests": [], "isolated_scripts": [ { "isolate_name": "webkit_layout_tests_exparchive", @@ -725,7 +786,6 @@ "test": "wtf_unittests" } ], - "isolated_scripts": [], "scripts": [ { "name": "webkit_lint",
diff --git a/testing/buildbot/chromium.webrtc.fyi.json b/testing/buildbot/chromium.webrtc.fyi.json index 30a31330..dfe64d57 100644 --- a/testing/buildbot/chromium.webrtc.fyi.json +++ b/testing/buildbot/chromium.webrtc.fyi.json
@@ -1,4 +1,6 @@ { + "AAAAA1 AUTOGENERATED FILE DO NOT EDIT": {}, + "AAAAA2 See generate_buildbot_json.py to make changes": {}, "Android Builder": { "additional_compile_targets": [ "all"
diff --git a/testing/buildbot/chromium.webrtc.json b/testing/buildbot/chromium.webrtc.json index 7768a76..6c289163 100644 --- a/testing/buildbot/chromium.webrtc.json +++ b/testing/buildbot/chromium.webrtc.json
@@ -1,4 +1,6 @@ { + "AAAAA1 AUTOGENERATED FILE DO NOT EDIT": {}, + "AAAAA2 See generate_buildbot_json.py to make changes": {}, "Linux Builder": { "additional_compile_targets": [ "browser_tests",
diff --git a/testing/buildbot/client.v8.branches.json b/testing/buildbot/client.v8.branches.json index 0967ef4..8aff5afe 100644 --- a/testing/buildbot/client.v8.branches.json +++ b/testing/buildbot/client.v8.branches.json
@@ -1 +1,4 @@ -{} +{ + "AAAAA1 AUTOGENERATED FILE DO NOT EDIT": {}, + "AAAAA2 See generate_buildbot_json.py to make changes": {} +}
diff --git a/testing/buildbot/generate_buildbot_json.py b/testing/buildbot/generate_buildbot_json.py index c7d55d7..103454f 100755 --- a/testing/buildbot/generate_buildbot_json.py +++ b/testing/buildbot/generate_buildbot_json.py
@@ -270,9 +270,10 @@ tester_config): if 'swarming' not in generated_test: generated_test['swarming'] = {} - generated_test['swarming'].update({ - 'can_use_on_swarming_builders': tester_config.get('use_swarming', True) - }) + if not 'can_use_on_swarming_builders' in generated_test['swarming']: + generated_test['swarming'].update({ + 'can_use_on_swarming_builders': tester_config.get('use_swarming', True) + }) if 'swarming' in tester_config: if 'dimension_sets' not in generated_test['swarming']: generated_test['swarming']['dimension_sets'] = copy.deepcopy(
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index 662688ee..3dc02ac 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -232,6 +232,32 @@ 'hard_timeout': 960, }, }, + # chromium.webkit + 'WebKit Mac10.10': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11 (dbg)': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11 (retina)': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.12': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, }, }, 'blink_platform_unittests': { @@ -254,6 +280,34 @@ 'Win10 Tests x64', 'Win7 Tests (dbg)(1)', ], + 'modifications': { + # on chromium.webkit + 'WebKit Mac10.10': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11 (dbg)': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11 (retina)': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.12': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + } }, 'boringssl_crypto_tests': { 'remove_from': [ @@ -424,6 +478,32 @@ 'shards': 20, }, }, + # on chromium.webkit + 'WebKit Mac10.10': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11 (dbg)': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11 (retina)': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.12': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, }, }, 'cacheinvalidation_unittests': { @@ -3023,6 +3103,177 @@ 'shards': 12, }, }, + + # TODO(dpranke): Clean up all of the unneeded exceptions on + # chromium.webkit. + 'WebKit Linux Trusty': { + 'swarming': { + 'dimension_sets': [ + { + 'os': 'Ubuntu-14.04', + }, + ], + }, + }, + 'WebKit Linux Trusty (dbg)': { + 'args': [ + '--debug', + ], + 'swarming': { + 'dimension_sets': [ + { + 'os': 'Ubuntu-14.04', + }, + ], + 'shards': 20, + }, + }, + 'WebKit Linux Trusty ASAN': { + 'args': [ + '--additional-expectations', + '../../third_party/WebKit/LayoutTests/ASANExpectations', + '--time-out-ms', + '48000', + '--enable-sanitizer', + ], + 'swarming': { + 'dimension_sets': [ + { + 'os': 'Ubuntu-14.04', + }, + ], + 'shards': 20, + }, + }, + 'WebKit Linux Trusty Leak': { + 'args': [ + '--additional-expectations', + '../../third_party/WebKit/LayoutTests/LeakExpectations', + '--time-out-ms', + '48000', + '--enable-leak-detection', + ], + 'swarming': { + 'dimension_sets': [ + { + 'os': 'Ubuntu-14.04', + }, + ], + 'shards': 10, + }, + }, + 'WebKit Linux Trusty MSAN': { + 'args': [ + '--additional-expectations', + '../../third_party/WebKit/LayoutTests/MSANExpectations', + '--time-out-ms', + '66000', + '--enable-sanitizer', + ], + 'swarming': { + 'dimension_sets': [ + { + 'os': 'Ubuntu-14.04', + }, + ], + 'expiration': 36000, + 'hard_timeout': 10800, + 'io_timeout': 3600, + 'shards': 20, + }, + }, + 'WebKit Mac10.10': { + 'swarming': { + 'dimension_sets': [ + { + 'gpu': 'none', + 'os': 'Mac-10.10.5', + } + ], + 'shards': 4, + }, + }, + 'WebKit Mac10.11': { + 'swarming': { + 'dimension_sets': [ + { + 'gpu': 'none', + 'os': 'Mac-10.11.6', + } + ], + 'shards': 4, + }, + }, + 'WebKit Mac10.11 (dbg)': { + 'args': [ + '--debug', + ], + 'swarming': { + 'dimension_sets': [ + { + 'gpu': 'none', + 'os': 'Mac-10.11.6', + } + ], + 'shards': 4, + }, + }, + 'WebKit Mac10.11 (retina)': { + 'swarming': { + 'dimension_sets': [ + { + 'gpu': '1002:6821', + 'hidpi': '1', + 'os': 'Mac-10.12.6', + 'pool': 'Chrome-GPU', + } + ], + 'shards': 4, + }, + }, + 'WebKit Mac10.12': { + 'swarming': { + 'dimension_sets': [ + { + 'gpu': '8086:0a2e', + 'hidpi': '0', + 'os': 'Mac-10.12.6', + }, + ], + 'shards': 4, + }, + }, + 'WebKit Win10': { + 'swarming': { + 'dimension_sets': [ + { + 'os': 'Windows-10-14393', + }, + ], + 'shards': 5, + }, + }, + 'WebKit Win7': { + 'swarming': { + 'dimension_sets': [ + { + 'os': 'Windows-7-SP1', + }, + ], + 'shards': 2, + }, + }, + 'WebKit Win7 (dbg)': { + 'swarming': { + 'dimension_sets': [ + { + 'os': 'Windows-7-SP1', + }, + ] + }, + 'shards': 2, + }, + 'Win7 Tests (dbg)(1)': { 'args': [ '--debug', @@ -3103,6 +3354,33 @@ 'Win10 Tests x64', 'Win7 Tests (dbg)(1)', ], + 'modifications': { + 'WebKit Mac10.10': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11 (dbg)': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11 (retina)': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.12': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + }, }, 'webview_instrumentation_test_apk': { 'remove_from': [ @@ -3230,6 +3508,33 @@ 'Win10 Tests x64', 'Win7 Tests (dbg)(1)', ], + 'modifications': { + 'WebKit Mac10.10': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11 (dbg)': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.11 (retina)': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + 'WebKit Mac10.12': { + 'swarming': { + 'can_use_on_swarming_builders': False, + }, + }, + }, }, 'zucchini_unittests': { 'remove_from': [
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 6cc1e62..12879a0 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -315,11 +315,40 @@ } }, + 'chromium_webkit_gtests': { + 'blink_heap_unittests': {}, + 'blink_platform_unittests': {}, + 'webkit_unit_tests': {}, + 'wtf_unittests': {}, + }, + 'chromium_webkit_isolated_scripts': { + 'webkit_layout_tests': { + 'isolate_name': 'webkit_layout_tests_exparchive', + 'merge': { + 'args': [ + '--verbose', + ], + 'script': '//third_party/WebKit/Tools/Scripts/merge-layout-test-results', + }, + 'results_handler': 'layout tests', + 'swarming': { + 'shards': 6, + } + }, + }, + 'chromium_webkit_scripts': { + 'webkit_lint': { + 'script': 'webkit_lint.py', + }, + 'webkit_python_tests': { + 'script': 'webkit_python_tests.py', + }, + }, + 'clang_gl_gtests': { 'gl_tests': {}, 'gl_unittests': {}, }, - 'clang_linux_and_mac_gtests': { # TODO: merge back into non_android_chromium_gtests. 'interactive_ui_tests': {}, @@ -452,6 +481,11 @@ 'sql_unittests': {}, }, + 'goma_gtests': { + 'base_unittests': {}, + 'content_unittests': {}, + }, + 'linux_and_android_specific_chromium_gtests': { 'renderer_side_navigation_content_browsertests': { 'args': [
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 583e177b..1b25a6a 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -325,6 +325,51 @@ }, }, { + 'name': 'chromium.angle', + 'machines': { + 'Linux Tests (ANGLE)': { + 'test_suites': { + 'gtest_tests': 'angle_gtests', + }, + }, + 'Linux Tests (dbg) (ANGLE)': { + 'test_suites': { + 'gtest_tests': 'angle_gtests', + }, + }, + 'Mac10.8 Tests (ANGLE)': { + 'test_suites': { + 'gtest_tests': 'angle_gtests', + }, + }, + 'Mac10.8 Tests (dbg) (ANGLE)': { + 'test_suites': { + 'gtest_tests': 'angle_gtests', + }, + }, + 'Win7 Tests (ANGLE)': { + 'test_suites': { + 'gtest_tests': 'angle_gtests', + }, + }, + 'Win7 Tests (dbg) (ANGLE)': { + 'test_suites': { + 'gtest_tests': 'angle_gtests', + }, + }, + 'Win7 Tests x64 (ANGLE)': { + 'test_suites': { + 'gtest_tests': 'angle_gtests', + }, + }, + 'Win7 Tests x64 (dbg) (ANGLE)': { + 'test_suites': { + 'gtest_tests': 'angle_gtests', + }, + }, + }, + }, + { 'name': 'chromium.chrome', 'machines': { }, @@ -593,6 +638,75 @@ }, }, { + 'name': 'chromium.goma', + 'machines': { + 'Chromium Linux Goma GCE Staging': { + 'additional_compile_targets': [ + 'all', + ], + 'test_suites': { + 'gtest_tests': 'goma_gtests', + }, + }, + 'Chromium Linux Goma Staging': { + 'additional_compile_targets': [ + 'all', + ], + 'test_suites': { + 'gtest_tests': 'goma_gtests', + }, + }, + 'Chromium Mac Goma GCE Staging': { + 'additional_compile_targets': [ + 'all', + ], + 'test_suites': { + 'gtest_tests': 'goma_gtests', + }, + }, + 'Chromium Mac Goma Staging': { + 'additional_compile_targets': [ + 'all', + ], + 'test_suites': { + 'gtest_tests': 'goma_gtests', + }, + }, + 'CrWinClangGomaGCEStaging': { + 'additional_compile_targets': [ + 'all', + ], + 'test_suites': { + 'gtest_tests': 'goma_gtests', + }, + }, + 'CrWinClexeGomaGCEStaging': { + 'additional_compile_targets': [ + 'all', + ], + 'test_suites': { + 'gtest_tests': 'goma_gtests', + }, + }, + 'CrWinGomaGCEStaging': { + 'additional_compile_targets': [ + 'all', + ], + 'test_suites': { + 'gtest_tests': 'goma_gtests', + }, + }, + 'CrWinGomaStaging': { + 'additional_compile_targets': [ + 'all', + ], + 'test_suites': { + 'gtest_tests': 'goma_gtests', + }, + }, + }, + }, + { 'name': 'chromium.linux', 'machines': { 'Fuchsia ARM64': { @@ -875,6 +989,214 @@ }, }, { + 'name': 'chromium.webkit', + 'machines': { + 'WebKit Linux Trusty': { + 'test_suites': { + 'gtest_tests': 'chromium_webkit_gtests', + 'isolated_scripts': 'chromium_webkit_isolated_scripts', + 'scripts': 'chromium_webkit_scripts', + }, + }, + 'WebKit Linux Trusty (dbg)': { + 'test_suites': { + 'gtest_tests': 'chromium_webkit_gtests', + 'isolated_scripts': 'chromium_webkit_isolated_scripts', + 'scripts': 'chromium_webkit_scripts', + }, + }, + 'WebKit Linux Trusty ASAN': { + 'test_suites': { + 'gtest_tests': 'chromium_webkit_gtests', + 'isolated_scripts': 'chromium_webkit_isolated_scripts', + }, + }, + 'WebKit Linux Trusty Leak': { + 'test_suites': { + 'gtest_tests': 'chromium_webkit_gtests', + 'isolated_scripts': 'chromium_webkit_isolated_scripts', + }, + }, + 'WebKit Linux Trusty MSAN': { + 'test_suites': { + 'gtest_tests': 'chromium_webkit_gtests', + 'isolated_scripts': 'chromium_webkit_isolated_scripts', + }, + }, + 'WebKit Mac10.10': { + 'test_suites': { + 'gtest_tests': 'chromium_webkit_gtests', + 'isolated_scripts': 'chromium_webkit_isolated_scripts', + 'scripts': 'chromium_webkit_scripts', + }, + }, + 'WebKit Mac10.11': { + 'test_suites': { + 'gtest_tests': 'chromium_webkit_gtests', + 'isolated_scripts': 'chromium_webkit_isolated_scripts', + 'scripts': 'chromium_webkit_scripts', + }, + }, + 'WebKit Mac10.11 (dbg)': { + 'test_suites': { + 'gtest_tests': 'chromium_webkit_gtests', + 'isolated_scripts': 'chromium_webkit_isolated_scripts', + 'scripts': 'chromium_webkit_scripts', + }, + }, + 'WebKit Mac10.11 (retina)': { + 'test_suites': { + 'gtest_tests': 'chromium_webkit_gtests', + 'isolated_scripts': 'chromium_webkit_isolated_scripts', + 'scripts': 'chromium_webkit_scripts', + }, + }, + 'WebKit Mac10.12': { + 'test_suites': { + 'gtest_tests': 'chromium_webkit_gtests', + 'isolated_scripts': 'chromium_webkit_isolated_scripts', + 'scripts': 'chromium_webkit_scripts', + }, + }, + 'WebKit Win x64 Builder': { + 'test_suites': { + 'gtest_tests': 'chromium_webkit_gtests', + }, + }, + 'WebKit Win x64 Builder (dbg)': { + 'test_suites': { + 'gtest_tests': 'chromium_webkit_gtests', + }, + }, + 'WebKit Win10': { + 'test_suites': { + 'gtest_tests': 'chromium_webkit_gtests', + 'isolated_scripts': 'chromium_webkit_isolated_scripts', + 'scripts': 'chromium_webkit_scripts', + }, + }, + 'WebKit Win7': { + 'test_suites': { + 'isolated_scripts': 'chromium_webkit_isolated_scripts', + 'scripts': 'chromium_webkit_scripts', + }, + }, + 'WebKit Win7 (dbg)': { + 'test_suites': { + 'gtest_tests': 'chromium_webkit_gtests', + 'scripts': 'chromium_webkit_scripts', + }, + }, + }, + }, + { + 'name': 'chromium.webrtc', + 'machines': { + 'Linux Builder': { + 'additional_compile_targets': [ + 'browser_tests', + 'capture_unittests', + 'content_browsertests', + 'content_unittests', + 'frame_analyzer', + 'jingle_unittests', + 'remoting_unittests', + ], + }, + 'Mac Builder': { + 'additional_compile_targets': [ + 'browser_tests', + 'capture_unittests', + 'content_browsertests', + 'content_unittests', + 'frame_analyzer', + 'jingle_unittests', + 'remoting_unittests', + ], + }, + 'Win Builder': { + 'additional_compile_targets': [ + 'browser_tests', + 'capture_unittests', + 'content_browsertests', + 'content_unittests', + 'frame_analyzer', + 'jingle_unittests', + 'remoting_unittests', + ], + }, + }, + }, + { + 'name': 'chromium.webrtc.fyi', + 'machines': { + 'Android Builder': { + 'additional_compile_targets': [ + 'all', + ], + }, + 'Android Builder (dbg)': { + 'additional_compile_targets': [ + 'content_browsertests', + ], + }, + 'Android Builder ARM64 (dbg)': { + 'additional_compile_targets': [ + 'content_browsertests', + ], + }, + 'Linux Builder': { + 'additional_compile_targets': [ + 'all', + ], + }, + 'Linux Builder (dbg)': { + 'additional_compile_targets': [ + 'all', + # TODO(dpranke): Specifying these additional targets is pointless :). + 'browser_tests', + 'capture_unittests', + 'content_browsertests', + 'content_unittests', + 'jingle_unittests', + 'remoting_unittests', + ], + }, + 'Mac Builder': { + 'additional_compile_targets': [ + 'all', + ], + }, + 'Mac Builder (dbg)': { + 'additional_compile_targets': [ + 'all', + 'browser_tests', + 'capture_unittests', + 'content_browsertests', + 'content_unittests', + 'jingle_unittests', + 'remoting_unittests', + ], + }, + 'Win Builder': { + 'additional_compile_targets': [ + 'all', + ], + }, + 'Win Builder (dbg)': { + 'additional_compile_targets': [ + 'all', + 'browser_tests', + 'capture_unittests', + 'content_browsertests', + 'content_unittests', + 'jingle_unittests', + 'remoting_unittests', + ], + }, + }, + }, + { 'name': 'chromium.win', 'machines': { 'Win Builder': { @@ -923,7 +1245,11 @@ 'gtest_tests': 'chromium_win_gtests', 'isolated_scripts': 'chromium_isolated_scripts', }, - } + }, }, }, + { + 'name': 'client.v8.branches', + 'machines': {}, + }, ]
diff --git a/ui/gl/BUILD.gn b/ui/gl/BUILD.gn index aba8548..04c0777 100644 --- a/ui/gl/BUILD.gn +++ b/ui/gl/BUILD.gn
@@ -324,10 +324,15 @@ static_library("gl_unittest_utils") { testonly = true sources = [ + "egl_bindings_autogen_mock.cc", + "egl_bindings_autogen_mock.h", + "egl_mock.cc", + "egl_mock.h", "gl_bindings_autogen_mock.cc", "gl_bindings_autogen_mock.h", "gl_mock.cc", "gl_mock.h", + "gl_mock_autogen_egl.h", "gl_mock_autogen_gl.h", "gpu_timing_fake.cc", "gpu_timing_fake.h",
diff --git a/ui/gl/egl_bindings_autogen_mock.cc b/ui/gl/egl_bindings_autogen_mock.cc new file mode 100644 index 0000000..514c551 --- /dev/null +++ b/ui/gl/egl_bindings_autogen_mock.cc
@@ -0,0 +1,743 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// This file is auto-generated from +// ui/gl/generate_bindings.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename +// DO NOT EDIT! + +#include <string.h> + +#include "ui/gl/egl_mock.h" + +namespace { +// This is called mainly to prevent the compiler combining the code of mock +// functions with identical contents, so that their function pointers will be +// different. +void MakeFunctionUnique(const char* func_name) { + VLOG(2) << "Calling mock " << func_name; +} +} // namespace + +namespace gl { + +EGLBoolean GL_BINDING_CALL MockEGLInterface::Mock_eglBindAPI(EGLenum api) { + MakeFunctionUnique("eglBindAPI"); + return interface_->BindAPI(api); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglBindTexImage(EGLDisplay dpy, + EGLSurface surface, + EGLint buffer) { + MakeFunctionUnique("eglBindTexImage"); + return interface_->BindTexImage(dpy, surface, buffer); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglChooseConfig(EGLDisplay dpy, + const EGLint* attrib_list, + EGLConfig* configs, + EGLint config_size, + EGLint* num_config) { + MakeFunctionUnique("eglChooseConfig"); + return interface_->ChooseConfig(dpy, attrib_list, configs, config_size, + num_config); +} + +EGLint GL_BINDING_CALL +MockEGLInterface::Mock_eglClientWaitSyncKHR(EGLDisplay dpy, + EGLSyncKHR sync, + EGLint flags, + EGLTimeKHR timeout) { + MakeFunctionUnique("eglClientWaitSyncKHR"); + return interface_->ClientWaitSyncKHR(dpy, sync, flags, timeout); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglCopyBuffers(EGLDisplay dpy, + EGLSurface surface, + EGLNativePixmapType target) { + MakeFunctionUnique("eglCopyBuffers"); + return interface_->CopyBuffers(dpy, surface, target); +} + +EGLContext GL_BINDING_CALL +MockEGLInterface::Mock_eglCreateContext(EGLDisplay dpy, + EGLConfig config, + EGLContext share_context, + const EGLint* attrib_list) { + MakeFunctionUnique("eglCreateContext"); + return interface_->CreateContext(dpy, config, share_context, attrib_list); +} + +EGLImageKHR GL_BINDING_CALL +MockEGLInterface::Mock_eglCreateImageKHR(EGLDisplay dpy, + EGLContext ctx, + EGLenum target, + EGLClientBuffer buffer, + const EGLint* attrib_list) { + MakeFunctionUnique("eglCreateImageKHR"); + return interface_->CreateImageKHR(dpy, ctx, target, buffer, attrib_list); +} + +EGLSurface GL_BINDING_CALL +MockEGLInterface::Mock_eglCreatePbufferFromClientBuffer( + EGLDisplay dpy, + EGLenum buftype, + void* buffer, + EGLConfig config, + const EGLint* attrib_list) { + MakeFunctionUnique("eglCreatePbufferFromClientBuffer"); + return interface_->CreatePbufferFromClientBuffer(dpy, buftype, buffer, config, + attrib_list); +} + +EGLSurface GL_BINDING_CALL +MockEGLInterface::Mock_eglCreatePbufferSurface(EGLDisplay dpy, + EGLConfig config, + const EGLint* attrib_list) { + MakeFunctionUnique("eglCreatePbufferSurface"); + return interface_->CreatePbufferSurface(dpy, config, attrib_list); +} + +EGLSurface GL_BINDING_CALL +MockEGLInterface::Mock_eglCreatePixmapSurface(EGLDisplay dpy, + EGLConfig config, + EGLNativePixmapType pixmap, + const EGLint* attrib_list) { + MakeFunctionUnique("eglCreatePixmapSurface"); + return interface_->CreatePixmapSurface(dpy, config, pixmap, attrib_list); +} + +EGLStreamKHR GL_BINDING_CALL +MockEGLInterface::Mock_eglCreateStreamKHR(EGLDisplay dpy, + const EGLint* attrib_list) { + MakeFunctionUnique("eglCreateStreamKHR"); + return interface_->CreateStreamKHR(dpy, attrib_list); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglCreateStreamProducerD3DTextureNV12ANGLE( + EGLDisplay dpy, + EGLStreamKHR stream, + EGLAttrib* attrib_list) { + MakeFunctionUnique("eglCreateStreamProducerD3DTextureNV12ANGLE"); + return interface_->CreateStreamProducerD3DTextureNV12ANGLE(dpy, stream, + attrib_list); +} + +EGLSyncKHR GL_BINDING_CALL +MockEGLInterface::Mock_eglCreateSyncKHR(EGLDisplay dpy, + EGLenum type, + const EGLint* attrib_list) { + MakeFunctionUnique("eglCreateSyncKHR"); + return interface_->CreateSyncKHR(dpy, type, attrib_list); +} + +EGLSurface GL_BINDING_CALL +MockEGLInterface::Mock_eglCreateWindowSurface(EGLDisplay dpy, + EGLConfig config, + EGLNativeWindowType win, + const EGLint* attrib_list) { + MakeFunctionUnique("eglCreateWindowSurface"); + return interface_->CreateWindowSurface(dpy, config, win, attrib_list); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglDestroyContext(EGLDisplay dpy, EGLContext ctx) { + MakeFunctionUnique("eglDestroyContext"); + return interface_->DestroyContext(dpy, ctx); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image) { + MakeFunctionUnique("eglDestroyImageKHR"); + return interface_->DestroyImageKHR(dpy, image); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglDestroyStreamKHR(EGLDisplay dpy, + EGLStreamKHR stream) { + MakeFunctionUnique("eglDestroyStreamKHR"); + return interface_->DestroyStreamKHR(dpy, stream); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglDestroySurface(EGLDisplay dpy, EGLSurface surface) { + MakeFunctionUnique("eglDestroySurface"); + return interface_->DestroySurface(dpy, surface); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) { + MakeFunctionUnique("eglDestroySyncKHR"); + return interface_->DestroySyncKHR(dpy, sync); +} + +EGLint GL_BINDING_CALL +MockEGLInterface::Mock_eglDupNativeFenceFDANDROID(EGLDisplay dpy, + EGLSyncKHR sync) { + MakeFunctionUnique("eglDupNativeFenceFDANDROID"); + return interface_->DupNativeFenceFDANDROID(dpy, sync); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglGetCompositorTimingANDROID(EGLDisplay dpy, + EGLSurface surface, + EGLint numTimestamps, + EGLint* names, + EGLnsecsANDROID* values) { + MakeFunctionUnique("eglGetCompositorTimingANDROID"); + return interface_->GetCompositorTimingANDROID(dpy, surface, numTimestamps, + names, values); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglGetCompositorTimingSupportedANDROID( + EGLDisplay dpy, + EGLSurface surface, + EGLint timestamp) { + MakeFunctionUnique("eglGetCompositorTimingSupportedANDROID"); + return interface_->GetCompositorTimingSupportedANDROID(dpy, surface, + timestamp); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglGetConfigAttrib(EGLDisplay dpy, + EGLConfig config, + EGLint attribute, + EGLint* value) { + MakeFunctionUnique("eglGetConfigAttrib"); + return interface_->GetConfigAttrib(dpy, config, attribute, value); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglGetConfigs(EGLDisplay dpy, + EGLConfig* configs, + EGLint config_size, + EGLint* num_config) { + MakeFunctionUnique("eglGetConfigs"); + return interface_->GetConfigs(dpy, configs, config_size, num_config); +} + +EGLContext GL_BINDING_CALL MockEGLInterface::Mock_eglGetCurrentContext(void) { + MakeFunctionUnique("eglGetCurrentContext"); + return interface_->GetCurrentContext(); +} + +EGLDisplay GL_BINDING_CALL MockEGLInterface::Mock_eglGetCurrentDisplay(void) { + MakeFunctionUnique("eglGetCurrentDisplay"); + return interface_->GetCurrentDisplay(); +} + +EGLSurface GL_BINDING_CALL +MockEGLInterface::Mock_eglGetCurrentSurface(EGLint readdraw) { + MakeFunctionUnique("eglGetCurrentSurface"); + return interface_->GetCurrentSurface(readdraw); +} + +EGLDisplay GL_BINDING_CALL +MockEGLInterface::Mock_eglGetDisplay(EGLNativeDisplayType display_id) { + MakeFunctionUnique("eglGetDisplay"); + return interface_->GetDisplay(display_id); +} + +EGLint GL_BINDING_CALL MockEGLInterface::Mock_eglGetError(void) { + MakeFunctionUnique("eglGetError"); + return interface_->GetError(); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglGetFrameTimestampSupportedANDROID(EGLDisplay dpy, + EGLSurface surface, + EGLint timestamp) { + MakeFunctionUnique("eglGetFrameTimestampSupportedANDROID"); + return interface_->GetFrameTimestampSupportedANDROID(dpy, surface, timestamp); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglGetFrameTimestampsANDROID(EGLDisplay dpy, + EGLSurface surface, + EGLuint64KHR frameId, + EGLint numTimestamps, + EGLint* timestamps, + EGLnsecsANDROID* values) { + MakeFunctionUnique("eglGetFrameTimestampsANDROID"); + return interface_->GetFrameTimestampsANDROID( + dpy, surface, frameId, numTimestamps, timestamps, values); +} + +EGLClientBuffer GL_BINDING_CALL +MockEGLInterface::Mock_eglGetNativeClientBufferANDROID( + const struct AHardwareBuffer* ahardwarebuffer) { + MakeFunctionUnique("eglGetNativeClientBufferANDROID"); + return interface_->GetNativeClientBufferANDROID(ahardwarebuffer); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglGetNextFrameIdANDROID(EGLDisplay dpy, + EGLSurface surface, + EGLuint64KHR* frameId) { + MakeFunctionUnique("eglGetNextFrameIdANDROID"); + return interface_->GetNextFrameIdANDROID(dpy, surface, frameId); +} + +EGLDisplay GL_BINDING_CALL +MockEGLInterface::Mock_eglGetPlatformDisplayEXT(EGLenum platform, + void* native_display, + const EGLint* attrib_list) { + MakeFunctionUnique("eglGetPlatformDisplayEXT"); + return interface_->GetPlatformDisplayEXT(platform, native_display, + attrib_list); +} + +__eglMustCastToProperFunctionPointerType GL_BINDING_CALL +MockEGLInterface::Mock_eglGetProcAddress(const char* procname) { + MakeFunctionUnique("eglGetProcAddress"); + return interface_->GetProcAddress(procname); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglGetSyncAttribKHR(EGLDisplay dpy, + EGLSyncKHR sync, + EGLint attribute, + EGLint* value) { + MakeFunctionUnique("eglGetSyncAttribKHR"); + return interface_->GetSyncAttribKHR(dpy, sync, attribute, value); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglGetSyncValuesCHROMIUM(EGLDisplay dpy, + EGLSurface surface, + EGLuint64CHROMIUM* ust, + EGLuint64CHROMIUM* msc, + EGLuint64CHROMIUM* sbc) { + MakeFunctionUnique("eglGetSyncValuesCHROMIUM"); + return interface_->GetSyncValuesCHROMIUM(dpy, surface, ust, msc, sbc); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglImageFlushExternalEXT(EGLDisplay dpy, + EGLImageKHR image, + const EGLAttrib* attrib_list) { + MakeFunctionUnique("eglImageFlushExternalEXT"); + return interface_->ImageFlushExternalEXT(dpy, image, attrib_list); +} + +EGLBoolean GL_BINDING_CALL MockEGLInterface::Mock_eglInitialize(EGLDisplay dpy, + EGLint* major, + EGLint* minor) { + MakeFunctionUnique("eglInitialize"); + return interface_->Initialize(dpy, major, minor); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglMakeCurrent(EGLDisplay dpy, + EGLSurface draw, + EGLSurface read, + EGLContext ctx) { + MakeFunctionUnique("eglMakeCurrent"); + return interface_->MakeCurrent(dpy, draw, read, ctx); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglPostSubBufferNV(EGLDisplay dpy, + EGLSurface surface, + EGLint x, + EGLint y, + EGLint width, + EGLint height) { + MakeFunctionUnique("eglPostSubBufferNV"); + return interface_->PostSubBufferNV(dpy, surface, x, y, width, height); +} + +EGLint GL_BINDING_CALL +MockEGLInterface::Mock_eglProgramCacheGetAttribANGLE(EGLDisplay dpy, + EGLenum attrib) { + MakeFunctionUnique("eglProgramCacheGetAttribANGLE"); + return interface_->ProgramCacheGetAttribANGLE(dpy, attrib); +} + +void GL_BINDING_CALL +MockEGLInterface::Mock_eglProgramCachePopulateANGLE(EGLDisplay dpy, + const void* key, + EGLint keysize, + const void* binary, + EGLint binarysize) { + MakeFunctionUnique("eglProgramCachePopulateANGLE"); + interface_->ProgramCachePopulateANGLE(dpy, key, keysize, binary, binarysize); +} + +void GL_BINDING_CALL +MockEGLInterface::Mock_eglProgramCacheQueryANGLE(EGLDisplay dpy, + EGLint index, + void* key, + EGLint* keysize, + void* binary, + EGLint* binarysize) { + MakeFunctionUnique("eglProgramCacheQueryANGLE"); + interface_->ProgramCacheQueryANGLE(dpy, index, key, keysize, binary, + binarysize); +} + +EGLint GL_BINDING_CALL +MockEGLInterface::Mock_eglProgramCacheResizeANGLE(EGLDisplay dpy, + EGLint limit, + EGLenum mode) { + MakeFunctionUnique("eglProgramCacheResizeANGLE"); + return interface_->ProgramCacheResizeANGLE(dpy, limit, mode); +} + +EGLenum GL_BINDING_CALL MockEGLInterface::Mock_eglQueryAPI(void) { + MakeFunctionUnique("eglQueryAPI"); + return interface_->QueryAPI(); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglQueryContext(EGLDisplay dpy, + EGLContext ctx, + EGLint attribute, + EGLint* value) { + MakeFunctionUnique("eglQueryContext"); + return interface_->QueryContext(dpy, ctx, attribute, value); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglQueryStreamKHR(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLint* value) { + MakeFunctionUnique("eglQueryStreamKHR"); + return interface_->QueryStreamKHR(dpy, stream, attribute, value); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglQueryStreamu64KHR(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLuint64KHR* value) { + MakeFunctionUnique("eglQueryStreamu64KHR"); + return interface_->QueryStreamu64KHR(dpy, stream, attribute, value); +} + +const char* GL_BINDING_CALL +MockEGLInterface::Mock_eglQueryString(EGLDisplay dpy, EGLint name) { + MakeFunctionUnique("eglQueryString"); + return interface_->QueryString(dpy, name); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglQuerySurface(EGLDisplay dpy, + EGLSurface surface, + EGLint attribute, + EGLint* value) { + MakeFunctionUnique("eglQuerySurface"); + return interface_->QuerySurface(dpy, surface, attribute, value); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglQuerySurfacePointerANGLE(EGLDisplay dpy, + EGLSurface surface, + EGLint attribute, + void** value) { + MakeFunctionUnique("eglQuerySurfacePointerANGLE"); + return interface_->QuerySurfacePointerANGLE(dpy, surface, attribute, value); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglReleaseTexImage(EGLDisplay dpy, + EGLSurface surface, + EGLint buffer) { + MakeFunctionUnique("eglReleaseTexImage"); + return interface_->ReleaseTexImage(dpy, surface, buffer); +} + +EGLBoolean GL_BINDING_CALL MockEGLInterface::Mock_eglReleaseThread(void) { + MakeFunctionUnique("eglReleaseThread"); + return interface_->ReleaseThread(); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglStreamAttribKHR(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLint value) { + MakeFunctionUnique("eglStreamAttribKHR"); + return interface_->StreamAttribKHR(dpy, stream, attribute, value); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglStreamConsumerAcquireKHR(EGLDisplay dpy, + EGLStreamKHR stream) { + MakeFunctionUnique("eglStreamConsumerAcquireKHR"); + return interface_->StreamConsumerAcquireKHR(dpy, stream); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglStreamConsumerGLTextureExternalAttribsNV( + EGLDisplay dpy, + EGLStreamKHR stream, + EGLAttrib* attrib_list) { + MakeFunctionUnique("eglStreamConsumerGLTextureExternalAttribsNV"); + return interface_->StreamConsumerGLTextureExternalAttribsNV(dpy, stream, + attrib_list); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglStreamConsumerGLTextureExternalKHR( + EGLDisplay dpy, + EGLStreamKHR stream) { + MakeFunctionUnique("eglStreamConsumerGLTextureExternalKHR"); + return interface_->StreamConsumerGLTextureExternalKHR(dpy, stream); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglStreamConsumerReleaseKHR(EGLDisplay dpy, + EGLStreamKHR stream) { + MakeFunctionUnique("eglStreamConsumerReleaseKHR"); + return interface_->StreamConsumerReleaseKHR(dpy, stream); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglStreamPostD3DTextureNV12ANGLE( + EGLDisplay dpy, + EGLStreamKHR stream, + void* texture, + const EGLAttrib* attrib_list) { + MakeFunctionUnique("eglStreamPostD3DTextureNV12ANGLE"); + return interface_->StreamPostD3DTextureNV12ANGLE(dpy, stream, texture, + attrib_list); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglSurfaceAttrib(EGLDisplay dpy, + EGLSurface surface, + EGLint attribute, + EGLint value) { + MakeFunctionUnique("eglSurfaceAttrib"); + return interface_->SurfaceAttrib(dpy, surface, attribute, value); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) { + MakeFunctionUnique("eglSwapBuffers"); + return interface_->SwapBuffers(dpy, surface); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglSwapBuffersWithDamageKHR(EGLDisplay dpy, + EGLSurface surface, + EGLint* rects, + EGLint n_rects) { + MakeFunctionUnique("eglSwapBuffersWithDamageKHR"); + return interface_->SwapBuffersWithDamageKHR(dpy, surface, rects, n_rects); +} + +EGLBoolean GL_BINDING_CALL +MockEGLInterface::Mock_eglSwapInterval(EGLDisplay dpy, EGLint interval) { + MakeFunctionUnique("eglSwapInterval"); + return interface_->SwapInterval(dpy, interval); +} + +EGLBoolean GL_BINDING_CALL MockEGLInterface::Mock_eglTerminate(EGLDisplay dpy) { + MakeFunctionUnique("eglTerminate"); + return interface_->Terminate(dpy); +} + +EGLBoolean GL_BINDING_CALL MockEGLInterface::Mock_eglWaitClient(void) { + MakeFunctionUnique("eglWaitClient"); + return interface_->WaitClient(); +} + +EGLBoolean GL_BINDING_CALL MockEGLInterface::Mock_eglWaitGL(void) { + MakeFunctionUnique("eglWaitGL"); + return interface_->WaitGL(); +} + +EGLBoolean GL_BINDING_CALL MockEGLInterface::Mock_eglWaitNative(EGLint engine) { + MakeFunctionUnique("eglWaitNative"); + return interface_->WaitNative(engine); +} + +EGLint GL_BINDING_CALL MockEGLInterface::Mock_eglWaitSyncKHR(EGLDisplay dpy, + EGLSyncKHR sync, + EGLint flags) { + MakeFunctionUnique("eglWaitSyncKHR"); + return interface_->WaitSyncKHR(dpy, sync, flags); +} + +static void MockInvalidFunction() { + NOTREACHED(); +} + +GLFunctionPointerType GL_BINDING_CALL +MockEGLInterface::GetGLProcAddress(const char* name) { + if (strcmp(name, "eglBindAPI") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglBindAPI); + if (strcmp(name, "eglBindTexImage") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglBindTexImage); + if (strcmp(name, "eglChooseConfig") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglChooseConfig); + if (strcmp(name, "eglClientWaitSyncKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglClientWaitSyncKHR); + if (strcmp(name, "eglCopyBuffers") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglCopyBuffers); + if (strcmp(name, "eglCreateContext") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglCreateContext); + if (strcmp(name, "eglCreateImageKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglCreateImageKHR); + if (strcmp(name, "eglCreatePbufferFromClientBuffer") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglCreatePbufferFromClientBuffer); + if (strcmp(name, "eglCreatePbufferSurface") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglCreatePbufferSurface); + if (strcmp(name, "eglCreatePixmapSurface") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglCreatePixmapSurface); + if (strcmp(name, "eglCreateStreamKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglCreateStreamKHR); + if (strcmp(name, "eglCreateStreamProducerD3DTextureNV12ANGLE") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglCreateStreamProducerD3DTextureNV12ANGLE); + if (strcmp(name, "eglCreateSyncKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglCreateSyncKHR); + if (strcmp(name, "eglCreateWindowSurface") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglCreateWindowSurface); + if (strcmp(name, "eglDestroyContext") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglDestroyContext); + if (strcmp(name, "eglDestroyImageKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglDestroyImageKHR); + if (strcmp(name, "eglDestroyStreamKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglDestroyStreamKHR); + if (strcmp(name, "eglDestroySurface") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglDestroySurface); + if (strcmp(name, "eglDestroySyncKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglDestroySyncKHR); + if (strcmp(name, "eglDupNativeFenceFDANDROID") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglDupNativeFenceFDANDROID); + if (strcmp(name, "eglGetCompositorTimingANDROID") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglGetCompositorTimingANDROID); + if (strcmp(name, "eglGetCompositorTimingSupportedANDROID") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglGetCompositorTimingSupportedANDROID); + if (strcmp(name, "eglGetConfigAttrib") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglGetConfigAttrib); + if (strcmp(name, "eglGetConfigs") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglGetConfigs); + if (strcmp(name, "eglGetCurrentContext") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglGetCurrentContext); + if (strcmp(name, "eglGetCurrentDisplay") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglGetCurrentDisplay); + if (strcmp(name, "eglGetCurrentSurface") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglGetCurrentSurface); + if (strcmp(name, "eglGetDisplay") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglGetDisplay); + if (strcmp(name, "eglGetError") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglGetError); + if (strcmp(name, "eglGetFrameTimestampSupportedANDROID") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglGetFrameTimestampSupportedANDROID); + if (strcmp(name, "eglGetFrameTimestampsANDROID") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglGetFrameTimestampsANDROID); + if (strcmp(name, "eglGetNativeClientBufferANDROID") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglGetNativeClientBufferANDROID); + if (strcmp(name, "eglGetNextFrameIdANDROID") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglGetNextFrameIdANDROID); + if (strcmp(name, "eglGetPlatformDisplayEXT") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglGetPlatformDisplayEXT); + if (strcmp(name, "eglGetProcAddress") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglGetProcAddress); + if (strcmp(name, "eglGetSyncAttribKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglGetSyncAttribKHR); + if (strcmp(name, "eglGetSyncValuesCHROMIUM") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglGetSyncValuesCHROMIUM); + if (strcmp(name, "eglImageFlushExternalEXT") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglImageFlushExternalEXT); + if (strcmp(name, "eglInitialize") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglInitialize); + if (strcmp(name, "eglMakeCurrent") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglMakeCurrent); + if (strcmp(name, "eglPostSubBufferNV") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglPostSubBufferNV); + if (strcmp(name, "eglProgramCacheGetAttribANGLE") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglProgramCacheGetAttribANGLE); + if (strcmp(name, "eglProgramCachePopulateANGLE") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglProgramCachePopulateANGLE); + if (strcmp(name, "eglProgramCacheQueryANGLE") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglProgramCacheQueryANGLE); + if (strcmp(name, "eglProgramCacheResizeANGLE") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglProgramCacheResizeANGLE); + if (strcmp(name, "eglQueryAPI") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglQueryAPI); + if (strcmp(name, "eglQueryContext") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglQueryContext); + if (strcmp(name, "eglQueryStreamKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglQueryStreamKHR); + if (strcmp(name, "eglQueryStreamu64KHR") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglQueryStreamu64KHR); + if (strcmp(name, "eglQueryString") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglQueryString); + if (strcmp(name, "eglQuerySurface") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglQuerySurface); + if (strcmp(name, "eglQuerySurfacePointerANGLE") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglQuerySurfacePointerANGLE); + if (strcmp(name, "eglReleaseTexImage") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglReleaseTexImage); + if (strcmp(name, "eglReleaseThread") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglReleaseThread); + if (strcmp(name, "eglStreamAttribKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglStreamAttribKHR); + if (strcmp(name, "eglStreamConsumerAcquireKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglStreamConsumerAcquireKHR); + if (strcmp(name, "eglStreamConsumerGLTextureExternalAttribsNV") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglStreamConsumerGLTextureExternalAttribsNV); + if (strcmp(name, "eglStreamConsumerGLTextureExternalKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglStreamConsumerGLTextureExternalKHR); + if (strcmp(name, "eglStreamConsumerReleaseKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglStreamConsumerReleaseKHR); + if (strcmp(name, "eglStreamPostD3DTextureNV12ANGLE") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglStreamPostD3DTextureNV12ANGLE); + if (strcmp(name, "eglSurfaceAttrib") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglSurfaceAttrib); + if (strcmp(name, "eglSwapBuffers") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglSwapBuffers); + if (strcmp(name, "eglSwapBuffersWithDamageKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>( + Mock_eglSwapBuffersWithDamageKHR); + if (strcmp(name, "eglSwapInterval") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglSwapInterval); + if (strcmp(name, "eglTerminate") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglTerminate); + if (strcmp(name, "eglWaitClient") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglWaitClient); + if (strcmp(name, "eglWaitGL") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglWaitGL); + if (strcmp(name, "eglWaitNative") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglWaitNative); + if (strcmp(name, "eglWaitSyncKHR") == 0) + return reinterpret_cast<GLFunctionPointerType>(Mock_eglWaitSyncKHR); + return reinterpret_cast<GLFunctionPointerType>(&MockInvalidFunction); +} + +} // namespace gl
diff --git a/ui/gl/egl_bindings_autogen_mock.h b/ui/gl/egl_bindings_autogen_mock.h new file mode 100644 index 0000000..409e8b5 --- /dev/null +++ b/ui/gl/egl_bindings_autogen_mock.h
@@ -0,0 +1,238 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// This file is auto-generated from +// ui/gl/generate_bindings.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename +// DO NOT EDIT! + +static EGLBoolean GL_BINDING_CALL Mock_eglBindAPI(EGLenum api); +static EGLBoolean GL_BINDING_CALL Mock_eglBindTexImage(EGLDisplay dpy, + EGLSurface surface, + EGLint buffer); +static EGLBoolean GL_BINDING_CALL +Mock_eglChooseConfig(EGLDisplay dpy, + const EGLint* attrib_list, + EGLConfig* configs, + EGLint config_size, + EGLint* num_config); +static EGLint GL_BINDING_CALL Mock_eglClientWaitSyncKHR(EGLDisplay dpy, + EGLSyncKHR sync, + EGLint flags, + EGLTimeKHR timeout); +static EGLBoolean GL_BINDING_CALL +Mock_eglCopyBuffers(EGLDisplay dpy, + EGLSurface surface, + EGLNativePixmapType target); +static EGLContext GL_BINDING_CALL +Mock_eglCreateContext(EGLDisplay dpy, + EGLConfig config, + EGLContext share_context, + const EGLint* attrib_list); +static EGLImageKHR GL_BINDING_CALL +Mock_eglCreateImageKHR(EGLDisplay dpy, + EGLContext ctx, + EGLenum target, + EGLClientBuffer buffer, + const EGLint* attrib_list); +static EGLSurface GL_BINDING_CALL +Mock_eglCreatePbufferFromClientBuffer(EGLDisplay dpy, + EGLenum buftype, + void* buffer, + EGLConfig config, + const EGLint* attrib_list); +static EGLSurface GL_BINDING_CALL +Mock_eglCreatePbufferSurface(EGLDisplay dpy, + EGLConfig config, + const EGLint* attrib_list); +static EGLSurface GL_BINDING_CALL +Mock_eglCreatePixmapSurface(EGLDisplay dpy, + EGLConfig config, + EGLNativePixmapType pixmap, + const EGLint* attrib_list); +static EGLStreamKHR GL_BINDING_CALL +Mock_eglCreateStreamKHR(EGLDisplay dpy, const EGLint* attrib_list); +static EGLBoolean GL_BINDING_CALL +Mock_eglCreateStreamProducerD3DTextureNV12ANGLE(EGLDisplay dpy, + EGLStreamKHR stream, + EGLAttrib* attrib_list); +static EGLSyncKHR GL_BINDING_CALL +Mock_eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint* attrib_list); +static EGLSurface GL_BINDING_CALL +Mock_eglCreateWindowSurface(EGLDisplay dpy, + EGLConfig config, + EGLNativeWindowType win, + const EGLint* attrib_list); +static EGLBoolean GL_BINDING_CALL Mock_eglDestroyContext(EGLDisplay dpy, + EGLContext ctx); +static EGLBoolean GL_BINDING_CALL Mock_eglDestroyImageKHR(EGLDisplay dpy, + EGLImageKHR image); +static EGLBoolean GL_BINDING_CALL Mock_eglDestroyStreamKHR(EGLDisplay dpy, + EGLStreamKHR stream); +static EGLBoolean GL_BINDING_CALL Mock_eglDestroySurface(EGLDisplay dpy, + EGLSurface surface); +static EGLBoolean GL_BINDING_CALL Mock_eglDestroySyncKHR(EGLDisplay dpy, + EGLSyncKHR sync); +static EGLint GL_BINDING_CALL Mock_eglDupNativeFenceFDANDROID(EGLDisplay dpy, + EGLSyncKHR sync); +static EGLBoolean GL_BINDING_CALL +Mock_eglGetCompositorTimingANDROID(EGLDisplay dpy, + EGLSurface surface, + EGLint numTimestamps, + EGLint* names, + EGLnsecsANDROID* values); +static EGLBoolean GL_BINDING_CALL +Mock_eglGetCompositorTimingSupportedANDROID(EGLDisplay dpy, + EGLSurface surface, + EGLint timestamp); +static EGLBoolean GL_BINDING_CALL Mock_eglGetConfigAttrib(EGLDisplay dpy, + EGLConfig config, + EGLint attribute, + EGLint* value); +static EGLBoolean GL_BINDING_CALL Mock_eglGetConfigs(EGLDisplay dpy, + EGLConfig* configs, + EGLint config_size, + EGLint* num_config); +static EGLContext GL_BINDING_CALL Mock_eglGetCurrentContext(void); +static EGLDisplay GL_BINDING_CALL Mock_eglGetCurrentDisplay(void); +static EGLSurface GL_BINDING_CALL Mock_eglGetCurrentSurface(EGLint readdraw); +static EGLDisplay GL_BINDING_CALL +Mock_eglGetDisplay(EGLNativeDisplayType display_id); +static EGLint GL_BINDING_CALL Mock_eglGetError(void); +static EGLBoolean GL_BINDING_CALL +Mock_eglGetFrameTimestampSupportedANDROID(EGLDisplay dpy, + EGLSurface surface, + EGLint timestamp); +static EGLBoolean GL_BINDING_CALL +Mock_eglGetFrameTimestampsANDROID(EGLDisplay dpy, + EGLSurface surface, + EGLuint64KHR frameId, + EGLint numTimestamps, + EGLint* timestamps, + EGLnsecsANDROID* values); +static EGLClientBuffer GL_BINDING_CALL Mock_eglGetNativeClientBufferANDROID( + const struct AHardwareBuffer* ahardwarebuffer); +static EGLBoolean GL_BINDING_CALL +Mock_eglGetNextFrameIdANDROID(EGLDisplay dpy, + EGLSurface surface, + EGLuint64KHR* frameId); +static EGLDisplay GL_BINDING_CALL +Mock_eglGetPlatformDisplayEXT(EGLenum platform, + void* native_display, + const EGLint* attrib_list); +static __eglMustCastToProperFunctionPointerType GL_BINDING_CALL +Mock_eglGetProcAddress(const char* procname); +static EGLBoolean GL_BINDING_CALL Mock_eglGetSyncAttribKHR(EGLDisplay dpy, + EGLSyncKHR sync, + EGLint attribute, + EGLint* value); +static EGLBoolean GL_BINDING_CALL +Mock_eglGetSyncValuesCHROMIUM(EGLDisplay dpy, + EGLSurface surface, + EGLuint64CHROMIUM* ust, + EGLuint64CHROMIUM* msc, + EGLuint64CHROMIUM* sbc); +static EGLBoolean GL_BINDING_CALL +Mock_eglImageFlushExternalEXT(EGLDisplay dpy, + EGLImageKHR image, + const EGLAttrib* attrib_list); +static EGLBoolean GL_BINDING_CALL Mock_eglInitialize(EGLDisplay dpy, + EGLint* major, + EGLint* minor); +static EGLBoolean GL_BINDING_CALL Mock_eglMakeCurrent(EGLDisplay dpy, + EGLSurface draw, + EGLSurface read, + EGLContext ctx); +static EGLBoolean GL_BINDING_CALL Mock_eglPostSubBufferNV(EGLDisplay dpy, + EGLSurface surface, + EGLint x, + EGLint y, + EGLint width, + EGLint height); +static EGLint GL_BINDING_CALL +Mock_eglProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib); +static void GL_BINDING_CALL +Mock_eglProgramCachePopulateANGLE(EGLDisplay dpy, + const void* key, + EGLint keysize, + const void* binary, + EGLint binarysize); +static void GL_BINDING_CALL Mock_eglProgramCacheQueryANGLE(EGLDisplay dpy, + EGLint index, + void* key, + EGLint* keysize, + void* binary, + EGLint* binarysize); +static EGLint GL_BINDING_CALL Mock_eglProgramCacheResizeANGLE(EGLDisplay dpy, + EGLint limit, + EGLenum mode); +static EGLenum GL_BINDING_CALL Mock_eglQueryAPI(void); +static EGLBoolean GL_BINDING_CALL Mock_eglQueryContext(EGLDisplay dpy, + EGLContext ctx, + EGLint attribute, + EGLint* value); +static EGLBoolean GL_BINDING_CALL Mock_eglQueryStreamKHR(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLint* value); +static EGLBoolean GL_BINDING_CALL +Mock_eglQueryStreamu64KHR(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLuint64KHR* value); +static const char* GL_BINDING_CALL Mock_eglQueryString(EGLDisplay dpy, + EGLint name); +static EGLBoolean GL_BINDING_CALL Mock_eglQuerySurface(EGLDisplay dpy, + EGLSurface surface, + EGLint attribute, + EGLint* value); +static EGLBoolean GL_BINDING_CALL +Mock_eglQuerySurfacePointerANGLE(EGLDisplay dpy, + EGLSurface surface, + EGLint attribute, + void** value); +static EGLBoolean GL_BINDING_CALL Mock_eglReleaseTexImage(EGLDisplay dpy, + EGLSurface surface, + EGLint buffer); +static EGLBoolean GL_BINDING_CALL Mock_eglReleaseThread(void); +static EGLBoolean GL_BINDING_CALL Mock_eglStreamAttribKHR(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLint value); +static EGLBoolean GL_BINDING_CALL +Mock_eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream); +static EGLBoolean GL_BINDING_CALL +Mock_eglStreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy, + EGLStreamKHR stream, + EGLAttrib* attrib_list); +static EGLBoolean GL_BINDING_CALL +Mock_eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream); +static EGLBoolean GL_BINDING_CALL +Mock_eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream); +static EGLBoolean GL_BINDING_CALL +Mock_eglStreamPostD3DTextureNV12ANGLE(EGLDisplay dpy, + EGLStreamKHR stream, + void* texture, + const EGLAttrib* attrib_list); +static EGLBoolean GL_BINDING_CALL Mock_eglSurfaceAttrib(EGLDisplay dpy, + EGLSurface surface, + EGLint attribute, + EGLint value); +static EGLBoolean GL_BINDING_CALL Mock_eglSwapBuffers(EGLDisplay dpy, + EGLSurface surface); +static EGLBoolean GL_BINDING_CALL +Mock_eglSwapBuffersWithDamageKHR(EGLDisplay dpy, + EGLSurface surface, + EGLint* rects, + EGLint n_rects); +static EGLBoolean GL_BINDING_CALL Mock_eglSwapInterval(EGLDisplay dpy, + EGLint interval); +static EGLBoolean GL_BINDING_CALL Mock_eglTerminate(EGLDisplay dpy); +static EGLBoolean GL_BINDING_CALL Mock_eglWaitClient(void); +static EGLBoolean GL_BINDING_CALL Mock_eglWaitGL(void); +static EGLBoolean GL_BINDING_CALL Mock_eglWaitNative(EGLint engine); +static EGLint GL_BINDING_CALL Mock_eglWaitSyncKHR(EGLDisplay dpy, + EGLSyncKHR sync, + EGLint flags);
diff --git a/ui/gl/egl_mock.cc b/ui/gl/egl_mock.cc new file mode 100644 index 0000000..c8bd3e1a --- /dev/null +++ b/ui/gl/egl_mock.cc
@@ -0,0 +1,19 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/gl/egl_mock.h" + +namespace gl { + +MockEGLInterface::MockEGLInterface() {} + +MockEGLInterface::~MockEGLInterface() {} + +MockEGLInterface* MockEGLInterface::interface_; + +void MockEGLInterface::SetEGLInterface(MockEGLInterface* egl_interface) { + interface_ = egl_interface; +} + +} // namespace gl
diff --git a/ui/gl/egl_mock.h b/ui/gl/egl_mock.h new file mode 100644 index 0000000..202da82c --- /dev/null +++ b/ui/gl/egl_mock.h
@@ -0,0 +1,48 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file implements mock EGL Interface for unit testing. The interface +// corresponds to the set of functionally distinct EGL functions defined in +// generate_bindings.py. + +#ifndef UI_GL_EGL_MOCK_H_ +#define UI_GL_EGL_MOCK_H_ + +#include "testing/gmock/include/gmock/gmock.h" +#include "ui/gl/gl_bindings.h" + +namespace gl { + +using GLFunctionPointerType = void (*)(); + +class MockEGLInterface { + public: + MockEGLInterface(); + virtual ~MockEGLInterface(); + + // Set the functions called from the mock EGL implementation for the purposes + // of testing. + static void SetEGLInterface(MockEGLInterface* egl_interface); + + // Find an entry point to the mock GL implementation. + static GLFunctionPointerType GL_BINDING_CALL + GetGLProcAddress(const char* name); + +// Include the auto-generated parts of this class. We split this because +// it means we can easily edit the non-auto generated parts right here in +// this file instead of having to edit some template or the code generator. + +// Member functions +#include "gl_mock_autogen_egl.h" + + private: + static MockEGLInterface* interface_; + +// Static mock functions that invoke the member functions of interface_. +#include "egl_bindings_autogen_mock.h" +}; + +} // namespace gl + +#endif // UI_GL_EGL_MOCK_H_
diff --git a/ui/gl/generate_bindings.py b/ui/gl/generate_bindings.py index 4cb9e7e..f5c2c990 100755 --- a/ui/gl/generate_bindings.py +++ b/ui/gl/generate_bindings.py
@@ -2601,7 +2601,8 @@ # For now gmock supports at most 10 args. if arg_count <= 10: file.write(' MOCK_METHOD%d(%s, %s(%s));\n' % - (arg_count, func['known_as'][2:], func['return_type'], args)) + (arg_count, func['known_as'][len(set_name):], func['return_type'], + args)) else: file.write(' // TODO(zmo): crbug.com/456340\n') file.write(' // %s cannot be mocked because it has %d args.\n' % @@ -3031,7 +3032,7 @@ (func['return_type'], func['name'], func['arguments'])) -def GenerateMockBindingsSource(file, functions): +def GenerateMockBindingsSource(file, functions, set_name): """Generates functions that invoke MockGLInterface members and a GetGLProcAddress function that returns addresses to those functions.""" @@ -3040,18 +3041,20 @@ #include <string.h> -#include "ui/gl/gl_mock.h" +#include "ui/gl/%s_mock.h" -namespace gl { - +namespace { // This is called mainly to prevent the compiler combining the code of mock // functions with identical contents, so that their function pointers will be // different. void MakeFunctionUnique(const char *func_name) { VLOG(2) << "Calling mock " << func_name; } +} // namespace -""") +namespace gl { +""" % (set_name,)) + # Write functions that trampoline into the set MockGLInterface instance. uniquely_named_functions = GetUniquelyNamedFunctions(functions) sorted_function_names = sorted(uniquely_named_functions.iterkeys()) @@ -3059,14 +3062,15 @@ for key in sorted_function_names: func = uniquely_named_functions[key] file.write('\n') - file.write('%s GL_BINDING_CALL MockGLInterface::Mock_%s(%s) {\n' % - (func['return_type'], func['name'], func['arguments'])) + file.write('%s GL_BINDING_CALL Mock%sInterface::Mock_%s(%s) {\n' % + (func['return_type'], set_name.upper(), func['name'], + func['arguments'])) file.write(' MakeFunctionUnique("%s");\n' % func['name']) - arg_re = r'(const )?[a-zA-Z0-9]+((\s*const\s*)?\*)* ([a-zA-Z0-9]+)' + arg_re = r'(const |struct )*[a-zA-Z0-9]+((\s*const\s*)?\*)* ([a-zA-Z0-9]+)' argument_names = re.sub(arg_re, r'\4', func['arguments']) if argument_names == 'void': argument_names = '' - function_name = func['known_as'][2:] + function_name = func['known_as'][len(set_name):] if func['return_type'] == 'void': file.write(' interface_->%s(%s);\n' % (function_name, argument_names)) @@ -3086,7 +3090,8 @@ # Write a function to lookup a mock GL function based on its name. file.write('\n') file.write('GLFunctionPointerType GL_BINDING_CALL ' + - 'MockGLInterface::GetGLProcAddress(const char* name) {\n') + 'Mock%sInterface::GetGLProcAddress(const char* name) {\n' % ( + set_name.upper(),)) for key in sorted_function_names: name = uniquely_named_functions[key]['name'] file.write(' if (strcmp(name, "%s") == 0)\n' % name) @@ -3481,7 +3486,25 @@ source_file = open(os.path.join(directory, 'gl_bindings_autogen_mock.cc'), 'wb') - GenerateMockBindingsSource(source_file, GL_FUNCTIONS) + GenerateMockBindingsSource(source_file, GL_FUNCTIONS, 'gl') + source_file.close() + ClangFormat(source_file.name) + + header_file = open( + os.path.join(directory, 'gl_mock_autogen_egl.h'), 'wb') + GenerateMockHeader(header_file, EGL_FUNCTIONS, 'egl') + header_file.close() + ClangFormat(header_file.name) + + header_file = open(os.path.join(directory, 'egl_bindings_autogen_mock.h'), + 'wb') + GenerateMockBindingsHeader(header_file, EGL_FUNCTIONS) + header_file.close() + ClangFormat(header_file.name) + + source_file = open(os.path.join(directory, 'egl_bindings_autogen_mock.cc'), + 'wb') + GenerateMockBindingsSource(source_file, EGL_FUNCTIONS, 'egl') source_file.close() ClangFormat(source_file.name)
diff --git a/ui/gl/gl_bindings_autogen_mock.cc b/ui/gl/gl_bindings_autogen_mock.cc index 7892f9c..72f639e9 100644 --- a/ui/gl/gl_bindings_autogen_mock.cc +++ b/ui/gl/gl_bindings_autogen_mock.cc
@@ -12,14 +12,16 @@ #include "ui/gl/gl_mock.h" -namespace gl { - +namespace { // This is called mainly to prevent the compiler combining the code of mock // functions with identical contents, so that their function pointers will be // different. void MakeFunctionUnique(const char* func_name) { VLOG(2) << "Calling mock " << func_name; } +} // namespace + +namespace gl { void GL_BINDING_CALL MockGLInterface::Mock_glActiveTexture(GLenum texture) { MakeFunctionUnique("glActiveTexture");
diff --git a/ui/gl/gl_mock_autogen_egl.h b/ui/gl/gl_mock_autogen_egl.h new file mode 100644 index 0000000..c4780e0 --- /dev/null +++ b/ui/gl/gl_mock_autogen_egl.h
@@ -0,0 +1,231 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// This file is auto-generated from +// ui/gl/generate_bindings.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename +// DO NOT EDIT! + +MOCK_METHOD1(BindAPI, EGLBoolean(EGLenum api)); +MOCK_METHOD3(BindTexImage, + EGLBoolean(EGLDisplay dpy, EGLSurface surface, EGLint buffer)); +MOCK_METHOD5(ChooseConfig, + EGLBoolean(EGLDisplay dpy, + const EGLint* attrib_list, + EGLConfig* configs, + EGLint config_size, + EGLint* num_config)); +MOCK_METHOD4( + ClientWaitSyncKHR, + EGLint(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)); +MOCK_METHOD3(CopyBuffers, + EGLBoolean(EGLDisplay dpy, + EGLSurface surface, + EGLNativePixmapType target)); +MOCK_METHOD4(CreateContext, + EGLContext(EGLDisplay dpy, + EGLConfig config, + EGLContext share_context, + const EGLint* attrib_list)); +MOCK_METHOD5(CreateImageKHR, + EGLImageKHR(EGLDisplay dpy, + EGLContext ctx, + EGLenum target, + EGLClientBuffer buffer, + const EGLint* attrib_list)); +MOCK_METHOD5(CreatePbufferFromClientBuffer, + EGLSurface(EGLDisplay dpy, + EGLenum buftype, + void* buffer, + EGLConfig config, + const EGLint* attrib_list)); +MOCK_METHOD3(CreatePbufferSurface, + EGLSurface(EGLDisplay dpy, + EGLConfig config, + const EGLint* attrib_list)); +MOCK_METHOD4(CreatePixmapSurface, + EGLSurface(EGLDisplay dpy, + EGLConfig config, + EGLNativePixmapType pixmap, + const EGLint* attrib_list)); +MOCK_METHOD2(CreateStreamKHR, + EGLStreamKHR(EGLDisplay dpy, const EGLint* attrib_list)); +MOCK_METHOD3(CreateStreamProducerD3DTextureNV12ANGLE, + EGLBoolean(EGLDisplay dpy, + EGLStreamKHR stream, + EGLAttrib* attrib_list)); +MOCK_METHOD3(CreateSyncKHR, + EGLSyncKHR(EGLDisplay dpy, + EGLenum type, + const EGLint* attrib_list)); +MOCK_METHOD4(CreateWindowSurface, + EGLSurface(EGLDisplay dpy, + EGLConfig config, + EGLNativeWindowType win, + const EGLint* attrib_list)); +MOCK_METHOD2(DestroyContext, EGLBoolean(EGLDisplay dpy, EGLContext ctx)); +MOCK_METHOD2(DestroyImageKHR, EGLBoolean(EGLDisplay dpy, EGLImageKHR image)); +MOCK_METHOD2(DestroyStreamKHR, EGLBoolean(EGLDisplay dpy, EGLStreamKHR stream)); +MOCK_METHOD2(DestroySurface, EGLBoolean(EGLDisplay dpy, EGLSurface surface)); +MOCK_METHOD2(DestroySyncKHR, EGLBoolean(EGLDisplay dpy, EGLSyncKHR sync)); +MOCK_METHOD2(DupNativeFenceFDANDROID, EGLint(EGLDisplay dpy, EGLSyncKHR sync)); +MOCK_METHOD5(GetCompositorTimingANDROID, + EGLBoolean(EGLDisplay dpy, + EGLSurface surface, + EGLint numTimestamps, + EGLint* names, + EGLnsecsANDROID* values)); +MOCK_METHOD3(GetCompositorTimingSupportedANDROID, + EGLBoolean(EGLDisplay dpy, EGLSurface surface, EGLint timestamp)); +MOCK_METHOD4(GetConfigAttrib, + EGLBoolean(EGLDisplay dpy, + EGLConfig config, + EGLint attribute, + EGLint* value)); +MOCK_METHOD4(GetConfigs, + EGLBoolean(EGLDisplay dpy, + EGLConfig* configs, + EGLint config_size, + EGLint* num_config)); +MOCK_METHOD0(GetCurrentContext, EGLContext()); +MOCK_METHOD0(GetCurrentDisplay, EGLDisplay()); +MOCK_METHOD1(GetCurrentSurface, EGLSurface(EGLint readdraw)); +MOCK_METHOD1(GetDisplay, EGLDisplay(EGLNativeDisplayType display_id)); +MOCK_METHOD0(GetError, EGLint()); +MOCK_METHOD6(GetFrameTimestampsANDROID, + EGLBoolean(EGLDisplay dpy, + EGLSurface surface, + EGLuint64KHR frameId, + EGLint numTimestamps, + EGLint* timestamps, + EGLnsecsANDROID* values)); +MOCK_METHOD3(GetFrameTimestampSupportedANDROID, + EGLBoolean(EGLDisplay dpy, EGLSurface surface, EGLint timestamp)); +MOCK_METHOD1(GetNativeClientBufferANDROID, + EGLClientBuffer(const struct AHardwareBuffer* ahardwarebuffer)); +MOCK_METHOD3(GetNextFrameIdANDROID, + EGLBoolean(EGLDisplay dpy, + EGLSurface surface, + EGLuint64KHR* frameId)); +MOCK_METHOD3(GetPlatformDisplayEXT, + EGLDisplay(EGLenum platform, + void* native_display, + const EGLint* attrib_list)); +MOCK_METHOD1(GetProcAddress, + __eglMustCastToProperFunctionPointerType(const char* procname)); +MOCK_METHOD4(GetSyncAttribKHR, + EGLBoolean(EGLDisplay dpy, + EGLSyncKHR sync, + EGLint attribute, + EGLint* value)); +MOCK_METHOD5(GetSyncValuesCHROMIUM, + EGLBoolean(EGLDisplay dpy, + EGLSurface surface, + EGLuint64CHROMIUM* ust, + EGLuint64CHROMIUM* msc, + EGLuint64CHROMIUM* sbc)); +MOCK_METHOD3(ImageFlushExternalEXT, + EGLBoolean(EGLDisplay dpy, + EGLImageKHR image, + const EGLAttrib* attrib_list)); +MOCK_METHOD3(Initialize, + EGLBoolean(EGLDisplay dpy, EGLint* major, EGLint* minor)); +MOCK_METHOD4(MakeCurrent, + EGLBoolean(EGLDisplay dpy, + EGLSurface draw, + EGLSurface read, + EGLContext ctx)); +MOCK_METHOD6(PostSubBufferNV, + EGLBoolean(EGLDisplay dpy, + EGLSurface surface, + EGLint x, + EGLint y, + EGLint width, + EGLint height)); +MOCK_METHOD2(ProgramCacheGetAttribANGLE, + EGLint(EGLDisplay dpy, EGLenum attrib)); +MOCK_METHOD5(ProgramCachePopulateANGLE, + void(EGLDisplay dpy, + const void* key, + EGLint keysize, + const void* binary, + EGLint binarysize)); +MOCK_METHOD6(ProgramCacheQueryANGLE, + void(EGLDisplay dpy, + EGLint index, + void* key, + EGLint* keysize, + void* binary, + EGLint* binarysize)); +MOCK_METHOD3(ProgramCacheResizeANGLE, + EGLint(EGLDisplay dpy, EGLint limit, EGLenum mode)); +MOCK_METHOD0(QueryAPI, EGLenum()); +MOCK_METHOD4(QueryContext, + EGLBoolean(EGLDisplay dpy, + EGLContext ctx, + EGLint attribute, + EGLint* value)); +MOCK_METHOD4(QueryStreamKHR, + EGLBoolean(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLint* value)); +MOCK_METHOD4(QueryStreamu64KHR, + EGLBoolean(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLuint64KHR* value)); +MOCK_METHOD2(QueryString, const char*(EGLDisplay dpy, EGLint name)); +MOCK_METHOD4(QuerySurface, + EGLBoolean(EGLDisplay dpy, + EGLSurface surface, + EGLint attribute, + EGLint* value)); +MOCK_METHOD4(QuerySurfacePointerANGLE, + EGLBoolean(EGLDisplay dpy, + EGLSurface surface, + EGLint attribute, + void** value)); +MOCK_METHOD3(ReleaseTexImage, + EGLBoolean(EGLDisplay dpy, EGLSurface surface, EGLint buffer)); +MOCK_METHOD0(ReleaseThread, EGLBoolean()); +MOCK_METHOD4(StreamAttribKHR, + EGLBoolean(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLint value)); +MOCK_METHOD2(StreamConsumerAcquireKHR, + EGLBoolean(EGLDisplay dpy, EGLStreamKHR stream)); +MOCK_METHOD3(StreamConsumerGLTextureExternalAttribsNV, + EGLBoolean(EGLDisplay dpy, + EGLStreamKHR stream, + EGLAttrib* attrib_list)); +MOCK_METHOD2(StreamConsumerGLTextureExternalKHR, + EGLBoolean(EGLDisplay dpy, EGLStreamKHR stream)); +MOCK_METHOD2(StreamConsumerReleaseKHR, + EGLBoolean(EGLDisplay dpy, EGLStreamKHR stream)); +MOCK_METHOD4(StreamPostD3DTextureNV12ANGLE, + EGLBoolean(EGLDisplay dpy, + EGLStreamKHR stream, + void* texture, + const EGLAttrib* attrib_list)); +MOCK_METHOD4(SurfaceAttrib, + EGLBoolean(EGLDisplay dpy, + EGLSurface surface, + EGLint attribute, + EGLint value)); +MOCK_METHOD2(SwapBuffers, EGLBoolean(EGLDisplay dpy, EGLSurface surface)); +MOCK_METHOD4(SwapBuffersWithDamageKHR, + EGLBoolean(EGLDisplay dpy, + EGLSurface surface, + EGLint* rects, + EGLint n_rects)); +MOCK_METHOD2(SwapInterval, EGLBoolean(EGLDisplay dpy, EGLint interval)); +MOCK_METHOD1(Terminate, EGLBoolean(EGLDisplay dpy)); +MOCK_METHOD0(WaitClient, EGLBoolean()); +MOCK_METHOD0(WaitGL, EGLBoolean()); +MOCK_METHOD1(WaitNative, EGLBoolean(EGLint engine)); +MOCK_METHOD3(WaitSyncKHR, + EGLint(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags));
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc index 34f20c7..3131eb8d 100644 --- a/ui/gl/gl_surface_egl.cc +++ b/ui/gl/gl_surface_egl.cc
@@ -566,7 +566,21 @@ // Must be called after InitializeDisplay(). g_driver_egl.InitializeExtensionBindings(); + return InitializeOneOffCommon(); +} + +// static +bool GLSurfaceEGL::InitializeOneOffForTesting() { + g_driver_egl.InitializeClientExtensionBindings(); + g_display = eglGetCurrentDisplay(); + g_driver_egl.InitializeExtensionBindings(); + return InitializeOneOffCommon(); +} + +// static +bool GLSurfaceEGL::InitializeOneOffCommon() { g_egl_extensions = eglQueryString(g_display, EGL_EXTENSIONS); + g_egl_create_context_robustness_supported = HasEGLExtension("EGL_EXT_create_context_robustness"); g_egl_create_context_bind_generates_resource_supported =
diff --git a/ui/gl/gl_surface_egl.h b/ui/gl/gl_surface_egl.h index dc98024..30a7196 100644 --- a/ui/gl/gl_surface_egl.h +++ b/ui/gl/gl_surface_egl.h
@@ -62,6 +62,7 @@ GLSurfaceFormat GetFormat() override; static bool InitializeOneOff(EGLNativeDisplayType native_display); + static bool InitializeOneOffForTesting(); static bool InitializeExtensionSettingsOneOff(); static void ShutdownOneOff(); static EGLDisplay GetHardwareDisplay(); @@ -92,6 +93,7 @@ private: DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGL); + static bool InitializeOneOffCommon(); static bool initialized_; };