Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: Source/web/tests/DrawingBufferTest.cpp

Issue 127493002: Removed most calls to GraphicsContext3D from DrawingBuffer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Moved texImage2DSafe to DrawingBuffer, it's only caller. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/platform/graphics/gpu/DrawingBuffer.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 static const int initialHeight = 100; 104 static const int initialHeight = 100;
105 static const int alternateHeight = 50; 105 static const int alternateHeight = 50;
106 106
107 } // namespace 107 } // namespace
108 108
109 class DrawingBufferTest : public Test { 109 class DrawingBufferTest : public Test {
110 protected: 110 protected:
111 virtual void SetUp() 111 virtual void SetUp()
112 { 112 {
113 RefPtr<FakeContextEvictionManager> contextEvictionManager = adoptRef(new FakeContextEvictionManager()); 113 RefPtr<FakeContextEvictionManager> contextEvictionManager = adoptRef(new FakeContextEvictionManager());
114 RefPtr<GraphicsContext3D> context = GraphicsContext3D::createGraphicsCon textFromWebContext(adoptPtr(new WebGraphicsContext3DForTests)); 114 m_context = adoptPtr(new WebGraphicsContext3DForTests);
115 m_drawingBuffer = DrawingBuffer::create(context.get(), IntSize(initialWi dth, initialHeight), DrawingBuffer::Preserve, contextEvictionManager.release()); 115 m_drawingBuffer = DrawingBuffer::create(m_context.get(), IntSize(initial Width, initialHeight), DrawingBuffer::Preserve, contextEvictionManager.release() );
116 } 116 }
117 117
118 WebGraphicsContext3DForTests* webContext() 118 WebGraphicsContext3DForTests* webContext()
119 { 119 {
120 return static_cast<WebGraphicsContext3DForTests*>(m_drawingBuffer->conte xt()); 120 return m_context.get();
121 } 121 }
122 122
123 OwnPtr<WebGraphicsContext3DForTests> m_context;
123 RefPtr<DrawingBuffer> m_drawingBuffer; 124 RefPtr<DrawingBuffer> m_drawingBuffer;
124 }; 125 };
125 126
126 namespace { 127 namespace {
127 128
128 TEST_F(DrawingBufferTest, verifyNoNewBuffersAfterContextLostWithMailboxes) 129 TEST_F(DrawingBufferTest, verifyNoNewBuffersAfterContextLostWithMailboxes)
129 { 130 {
130 // Tell the buffer its contents changed and context was lost. 131 // Tell the buffer its contents changed and context was lost.
131 m_drawingBuffer->markContentsChanged(); 132 m_drawingBuffer->markContentsChanged();
132 m_drawingBuffer->releaseResources(); 133 m_drawingBuffer->releaseResources();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&recycledMailbox, 0)); 223 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&recycledMailbox, 0));
223 EXPECT_EQ(TextureMailboxWrapper(mailbox3), TextureMailboxWrapper(recycledMai lbox)); 224 EXPECT_EQ(TextureMailboxWrapper(mailbox3), TextureMailboxWrapper(recycledMai lbox));
224 225
225 // The third recycled mailbox must be 1. 226 // The third recycled mailbox must be 1.
226 m_drawingBuffer->markContentsChanged(); 227 m_drawingBuffer->markContentsChanged();
227 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&recycledMailbox, 0)); 228 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&recycledMailbox, 0));
228 EXPECT_EQ(TextureMailboxWrapper(mailbox1), TextureMailboxWrapper(recycledMai lbox)); 229 EXPECT_EQ(TextureMailboxWrapper(mailbox1), TextureMailboxWrapper(recycledMai lbox));
229 } 230 }
230 231
231 } // namespace 232 } // namespace
OLDNEW
« no previous file with comments | « Source/platform/graphics/gpu/DrawingBuffer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698