| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "public/platform/WebScheduler.h" | 40 #include "public/platform/WebScheduler.h" |
| 41 #include "public/platform/WebTaskRunner.h" | 41 #include "public/platform/WebTaskRunner.h" |
| 42 #include "public/platform/WebThread.h" | 42 #include "public/platform/WebThread.h" |
| 43 #include "public/platform/WebTraceLocation.h" | 43 #include "public/platform/WebTraceLocation.h" |
| 44 #include "public/platform/callback/WebClosure.h" | 44 #include "public/platform/callback/WebClosure.h" |
| 45 #include "skia/ext/texture_handle.h" | 45 #include "skia/ext/texture_handle.h" |
| 46 #include "testing/gmock/include/gmock/gmock.h" | 46 #include "testing/gmock/include/gmock/gmock.h" |
| 47 #include "testing/gtest/include/gtest/gtest.h" | 47 #include "testing/gtest/include/gtest/gtest.h" |
| 48 #include "third_party/skia/include/core/SkCanvas.h" | 48 #include "third_party/skia/include/core/SkCanvas.h" |
| 49 #include "third_party/skia/include/gpu/GrContext.h" | 49 #include "third_party/skia/include/gpu/GrContext.h" |
| 50 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" |
| 50 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" | 51 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" |
| 51 #include "third_party/skia/include/gpu/gl/SkNullGLContext.h" | |
| 52 #include "wtf/RefPtr.h" | 52 #include "wtf/RefPtr.h" |
| 53 | 53 |
| 54 using testing::AnyNumber; | 54 using testing::AnyNumber; |
| 55 using testing::AtLeast; | 55 using testing::AtLeast; |
| 56 using testing::InSequence; | 56 using testing::InSequence; |
| 57 using testing::Return; | 57 using testing::Return; |
| 58 using testing::Test; | 58 using testing::Test; |
| 59 using testing::_; | 59 using testing::_; |
| 60 | 60 |
| 61 namespace blink { | 61 namespace blink { |
| 62 | 62 |
| 63 namespace { | 63 namespace { |
| 64 | 64 |
| 65 class MockCanvasContext : public MockWebGraphicsContext3D { | 65 class MockCanvasContext : public MockWebGraphicsContext3D { |
| 66 public: | 66 public: |
| 67 MOCK_METHOD0(flush, void(void)); | 67 MOCK_METHOD0(flush, void(void)); |
| 68 MOCK_METHOD0(createTexture, unsigned(void)); | 68 MOCK_METHOD0(createTexture, unsigned(void)); |
| 69 MOCK_METHOD1(deleteTexture, void(unsigned)); | 69 MOCK_METHOD1(deleteTexture, void(unsigned)); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 class MockWebGraphicsContext3DProvider : public WebGraphicsContext3DProvider { | 72 class MockWebGraphicsContext3DProvider : public WebGraphicsContext3DProvider { |
| 73 public: | 73 public: |
| 74 MockWebGraphicsContext3DProvider(WebGraphicsContext3D* context3d, gpu::gles2
::GLES2Interface* gl) | 74 MockWebGraphicsContext3DProvider(WebGraphicsContext3D* context3d, gpu::gles2
::GLES2Interface* gl) |
| 75 : m_context3d(context3d) | 75 : m_context3d(context3d) |
| 76 , m_gl(gl) | 76 , m_gl(gl) |
| 77 { | 77 { |
| 78 scoped_ptr<SkGLContext> glContext(SkNullGLContext::Create()); | 78 RefPtr<const GrGLInterface> glInterface = adoptRef(GrGLCreateNullInterfa
ce()); |
| 79 glContext->makeCurrent(); | 79 m_grContext = adoptRef(GrContext::Create(kOpenGL_GrBackend, reinterpret_
cast<GrBackendContext>(glInterface.get()))); |
| 80 m_grContext = adoptRef(GrContext::Create(kOpenGL_GrBackend, reinterpret_
cast<GrBackendContext>(glContext->gl()))); | |
| 81 } | 80 } |
| 82 | 81 |
| 83 WebGraphicsContext3D* context3d() override | 82 WebGraphicsContext3D* context3d() override |
| 84 { | 83 { |
| 85 return m_context3d; | 84 return m_context3d; |
| 86 } | 85 } |
| 87 | 86 |
| 88 GrContext* grContext() override | 87 GrContext* grContext() override |
| 89 { | 88 { |
| 90 return m_grContext.get(); | 89 return m_grContext.get(); |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 WebExternalTextureMailbox mailbox; | 1126 WebExternalTextureMailbox mailbox; |
| 1128 EXPECT_FALSE(bridge->prepareMailbox(&mailbox, 0)); | 1127 EXPECT_FALSE(bridge->prepareMailbox(&mailbox, 0)); |
| 1129 EXPECT_TRUE(bridge->checkSurfaceValid()); | 1128 EXPECT_TRUE(bridge->checkSurfaceValid()); |
| 1130 | 1129 |
| 1131 // Tear down the bridge on the thread so that 'bridge' can go out of scope | 1130 // Tear down the bridge on the thread so that 'bridge' can go out of scope |
| 1132 // without crashing due to thread checks | 1131 // without crashing due to thread checks |
| 1133 postAndWaitDestroyBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge); | 1132 postAndWaitDestroyBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge); |
| 1134 } | 1133 } |
| 1135 | 1134 |
| 1136 } // namespace blink | 1135 } // namespace blink |
| OLD | NEW |