Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // These tests are run twice: | |
| 6 // Once in a gpu test with an in-process WebGraphicsContext3D. | |
| 7 // Once in a browsertest with a gpu-process WebGraphicsContext3D. | |
| 8 | |
| 9 #include "base/bind.h" | |
| 10 #include "base/run_loop.h" | |
| 11 #include "cc/resources/sync_point_helper.h" | |
| 12 #include "gpu/GLES2/gl2extchromium.h" | |
| 13 | |
| 14 namespace { | |
| 15 | |
| 16 class SignalTest : public ContextTestBase { | |
| 17 public: | |
| 18 static void RunOnlyOnce(base::Closure cb, int *tmp) { | |
| 19 CHECK_EQ(*tmp, 0); | |
| 20 ++*tmp; | |
| 21 cb.Run(); | |
| 22 } | |
| 23 | |
| 24 // These tests should time out if the callback doesn't get called. | |
| 25 void testSignalSyncPoint(unsigned sync_point) { | |
| 26 base::RunLoop run_loop; | |
| 27 cc::SyncPointHelper::SignalSyncPoint( | |
| 28 context_.get(), sync_point, run_loop.QuitClosure()); | |
| 29 context_->flush(); | |
|
piman
2013/06/26 21:41:03
nit: why the need for flush here?
The insertSyncPo
hubbe
2013/06/27 20:42:40
But it does. Without the flush, this test does not
piman
2013/06/27 20:51:34
It sounds like the missing flush would be in the i
hubbe
2013/06/27 22:52:11
Fix implemented as per discussion.
| |
| 30 run_loop.Run(); | |
| 31 } | |
| 32 | |
| 33 // These tests should time out if the callback doesn't get called. | |
| 34 void testSignalQuery(WebKit::WebGLId query) { | |
| 35 base::RunLoop run_loop; | |
| 36 cc::SyncPointHelper::SignalQuery( | |
| 37 context_.get(), query, | |
| 38 base::Bind(&RunOnlyOnce, run_loop.QuitClosure(), | |
| 39 base::Owned(new int(0)))); | |
| 40 run_loop.Run(); | |
| 41 } | |
| 42 }; | |
| 43 | |
| 44 CONTEXT_TEST_F(SignalTest, BasicSignalSyncPointTest) { | |
| 45 testSignalSyncPoint(context_->insertSyncPoint()); | |
| 46 }; | |
| 47 | |
| 48 CONTEXT_TEST_F(SignalTest, InvalidSignalSyncPointTest) { | |
| 49 // Signalling something that doesn't exist should run the callback | |
| 50 // immediately. | |
| 51 testSignalSyncPoint(1297824234); | |
| 52 }; | |
| 53 | |
| 54 CONTEXT_TEST_F(SignalTest, BasicSignalQueryTest) { | |
| 55 unsigned query = context_->createQueryEXT(); | |
| 56 context_->beginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM, query); | |
| 57 context_->finish(); | |
| 58 context_->endQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM); | |
| 59 testSignalQuery(query); | |
| 60 context_->deleteQueryEXT(query); | |
| 61 }; | |
| 62 | |
| 63 CONTEXT_TEST_F(SignalTest, SignalQueryUnboundTest) { | |
| 64 WebKit::WebGLId query = context_->createQueryEXT(); | |
| 65 testSignalQuery(query); | |
| 66 context_->deleteQueryEXT(query); | |
| 67 }; | |
| 68 | |
| 69 CONTEXT_TEST_F(SignalTest, InvalidSignalQueryUnboundTest) { | |
| 70 // Signalling something that doesn't exist should run the callback | |
| 71 // immediately. | |
| 72 testSignalQuery(928729087); | |
| 73 testSignalQuery(928729086); | |
| 74 testSignalQuery(928729085); | |
| 75 testSignalQuery(928729083); | |
| 76 testSignalQuery(928729082); | |
| 77 testSignalQuery(928729081); | |
| 78 }; | |
| 79 | |
| 80 }; | |
| OLD | NEW |