| 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 21 matching lines...) Expand all Loading... |
| 32 #include "platform/graphics/ImageBuffer.h" | 32 #include "platform/graphics/ImageBuffer.h" |
| 33 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | 33 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
| 34 #include "platform/graphics/test/MockWebGraphicsContext3D.h" | 34 #include "platform/graphics/test/MockWebGraphicsContext3D.h" |
| 35 #include "public/platform/Platform.h" | 35 #include "public/platform/Platform.h" |
| 36 #include "public/platform/WebExternalBitmap.h" | 36 #include "public/platform/WebExternalBitmap.h" |
| 37 #include "public/platform/WebGraphicsContext3DProvider.h" | 37 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 38 #include "public/platform/WebScheduler.h" | 38 #include "public/platform/WebScheduler.h" |
| 39 #include "public/platform/WebTaskRunner.h" | 39 #include "public/platform/WebTaskRunner.h" |
| 40 #include "public/platform/WebThread.h" | 40 #include "public/platform/WebThread.h" |
| 41 #include "public/platform/WebTraceLocation.h" | 41 #include "public/platform/WebTraceLocation.h" |
| 42 #include "skia/ext/texture_handle.h" |
| 42 #include "testing/gmock/include/gmock/gmock.h" | 43 #include "testing/gmock/include/gmock/gmock.h" |
| 43 #include "testing/gtest/include/gtest/gtest.h" | 44 #include "testing/gtest/include/gtest/gtest.h" |
| 44 #include "third_party/skia/include/core/SkCanvas.h" | 45 #include "third_party/skia/include/core/SkCanvas.h" |
| 45 #include "third_party/skia/include/gpu/GrContext.h" | 46 #include "third_party/skia/include/gpu/GrContext.h" |
| 47 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" |
| 46 #include "third_party/skia/include/gpu/gl/SkNullGLContext.h" | 48 #include "third_party/skia/include/gpu/gl/SkNullGLContext.h" |
| 47 #include "wtf/RefPtr.h" | 49 #include "wtf/RefPtr.h" |
| 48 | 50 |
| 49 using testing::AnyNumber; | 51 using testing::AnyNumber; |
| 50 using testing::AtLeast; | 52 using testing::AtLeast; |
| 51 using testing::InSequence; | 53 using testing::InSequence; |
| 52 using testing::Return; | 54 using testing::Return; |
| 53 using testing::Test; | 55 using testing::Test; |
| 54 using testing::_; | 56 using testing::_; |
| 55 | 57 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 MockCanvasContext mainMock; | 155 MockCanvasContext mainMock; |
| 154 OwnPtr<MockWebGraphicsContext3DProvider> mainMockProvider = adoptPtr(new
MockWebGraphicsContext3DProvider(&mainMock)); | 156 OwnPtr<MockWebGraphicsContext3DProvider> mainMockProvider = adoptPtr(new
MockWebGraphicsContext3DProvider(&mainMock)); |
| 155 | 157 |
| 156 ::testing::Mock::VerifyAndClearExpectations(&mainMock); | 158 ::testing::Mock::VerifyAndClearExpectations(&mainMock); |
| 157 | 159 |
| 158 { | 160 { |
| 159 Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(mainM
ockProvider.release(), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::Dis
ableAcceleration))); | 161 Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(mainM
ockProvider.release(), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::Dis
ableAcceleration))); |
| 160 | 162 |
| 161 ::testing::Mock::VerifyAndClearExpectations(&mainMock); | 163 ::testing::Mock::VerifyAndClearExpectations(&mainMock); |
| 162 | 164 |
| 163 unsigned textureId = bridge->newImageSnapshot(PreferAcceleration, Sn
apshotReasonUnknown)->getTextureHandle(true); | 165 const GrGLTextureInfo* textureInfo = skia::GrBackendObjectToGrGLText
ureHandle(bridge->newImageSnapshot(PreferAcceleration, SnapshotReasonUnknown)->g
etTextureHandle(true)); |
| 164 EXPECT_EQ(textureId, 0u); | 166 EXPECT_EQ(textureInfo, nullptr); |
| 165 | 167 |
| 166 ::testing::Mock::VerifyAndClearExpectations(&mainMock); | 168 ::testing::Mock::VerifyAndClearExpectations(&mainMock); |
| 167 } // bridge goes out of scope here | 169 } // bridge goes out of scope here |
| 168 | 170 |
| 169 ::testing::Mock::VerifyAndClearExpectations(&mainMock); | 171 ::testing::Mock::VerifyAndClearExpectations(&mainMock); |
| 170 } | 172 } |
| 171 | 173 |
| 172 void fallbackToSoftwareIfContextLost() | 174 void fallbackToSoftwareIfContextLost() |
| 173 { | 175 { |
| 174 MockCanvasContext mainMock; | 176 MockCanvasContext mainMock; |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 WebExternalTextureMailbox mailbox; | 994 WebExternalTextureMailbox mailbox; |
| 993 EXPECT_FALSE(bridge->prepareMailbox(&mailbox, 0)); | 995 EXPECT_FALSE(bridge->prepareMailbox(&mailbox, 0)); |
| 994 EXPECT_TRUE(bridge->checkSurfaceValid()); | 996 EXPECT_TRUE(bridge->checkSurfaceValid()); |
| 995 | 997 |
| 996 // Tear down the bridge on the thread so that 'bridge' can go out of scope | 998 // Tear down the bridge on the thread so that 'bridge' can go out of scope |
| 997 // without crashing due to thread checks | 999 // without crashing due to thread checks |
| 998 postAndWaitDestroyBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge); | 1000 postAndWaitDestroyBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge); |
| 999 } | 1001 } |
| 1000 | 1002 |
| 1001 } // namespace blink | 1003 } // namespace blink |
| OLD | NEW |