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.
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.
10 #include "base/run_loop.h"
11 #include "gpu/GLES2/gl2extchromium.h"
12 #include "gpu/command_buffer/client/context_support.h"
16 class SignalTest
: public ContextTestBase
{
18 static void RunOnlyOnce(base::Closure cb
, int* tmp
) {
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 context_support_
->SignalSyncPoint(sync_point
, run_loop
.QuitClosure());
31 // These tests should time out if the callback doesn't get called.
32 void TestSignalQuery(blink::WebGLId query
) {
33 base::RunLoop run_loop
;
34 context_support_
->SignalQuery(
37 &RunOnlyOnce
, run_loop
.QuitClosure(), base::Owned(new int(0))));
42 CONTEXT_TEST_F(SignalTest
, BasicSignalSyncPointTest
) {
46 TestSignalSyncPoint(context_
->insertSyncPoint());
49 CONTEXT_TEST_F(SignalTest
, InvalidSignalSyncPointTest
) {
53 // Signalling something that doesn't exist should run the callback
55 TestSignalSyncPoint(1297824234);
58 CONTEXT_TEST_F(SignalTest
, BasicSignalQueryTest
) {
62 unsigned query
= context_
->createQueryEXT();
63 context_
->beginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM
, query
);
65 context_
->endQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM
);
66 TestSignalQuery(query
);
67 context_
->deleteQueryEXT(query
);
70 CONTEXT_TEST_F(SignalTest
, SignalQueryUnboundTest
) {
74 blink::WebGLId query
= context_
->createQueryEXT();
75 TestSignalQuery(query
);
76 context_
->deleteQueryEXT(query
);
79 CONTEXT_TEST_F(SignalTest
, InvalidSignalQueryUnboundTest
) {
83 // Signalling something that doesn't exist should run the callback
85 TestSignalQuery(928729087);
86 TestSignalQuery(928729086);
87 TestSignalQuery(928729085);
88 TestSignalQuery(928729083);
89 TestSignalQuery(928729082);
90 TestSignalQuery(928729081);