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

Side by Side Diff: content/common/gpu/client/gpu_context_tests.h

Issue 1807813002: Remove WebGraphicsContext3D dependency in gpu_context_tests.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wgc3d-unused
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // These tests are run twice: 5 // These tests are run twice:
6 // Once in a gpu test with an in-process WebGraphicsContext3D. 6 // Once in a gpu test with an in-process WebGraphicsContext3D.
7 // Once in a browsertest with a gpu-process WebGraphicsContext3D. 7 // Once in a browsertest with a gpu-process WebGraphicsContext3D.
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 // These tests should time out if the callback doesn't get called. 26 // These tests should time out if the callback doesn't get called.
27 void TestSignalSyncToken(const gpu::SyncToken& sync_token) { 27 void TestSignalSyncToken(const gpu::SyncToken& sync_token) {
28 base::RunLoop run_loop; 28 base::RunLoop run_loop;
29 context_support_->SignalSyncToken(sync_token, run_loop.QuitClosure()); 29 context_support_->SignalSyncToken(sync_token, run_loop.QuitClosure());
30 run_loop.Run(); 30 run_loop.Run();
31 } 31 }
32 32
33 // These tests should time out if the callback doesn't get called. 33 // These tests should time out if the callback doesn't get called.
34 void TestSignalQuery(blink::WebGLId query) { 34 void TestSignalQuery(GLuint query) {
35 base::RunLoop run_loop; 35 base::RunLoop run_loop;
36 context_support_->SignalQuery( 36 context_support_->SignalQuery(
37 query, 37 query,
38 base::Bind( 38 base::Bind(
39 &RunOnlyOnce, run_loop.QuitClosure(), base::Owned(new int(0)))); 39 &RunOnlyOnce, run_loop.QuitClosure(), base::Owned(new int(0))));
40 run_loop.Run(); 40 run_loop.Run();
41 } 41 }
42 }; 42 };
43 43
44 CONTEXT_TEST_F(SignalTest, BasicSignalSyncTokenTest) { 44 CONTEXT_TEST_F(SignalTest, BasicSignalSyncTokenTest) {
45 if (!context_) 45 const GLuint64 fence_sync = gl_->InsertFenceSyncCHROMIUM();
46 return; 46 gl_->ShallowFlushCHROMIUM();
47
48 const blink::WGC3Duint64 fence_sync = context_->insertFenceSyncCHROMIUM();
49 context_->GetGLInterface()->ShallowFlushCHROMIUM();
50 47
51 gpu::SyncToken sync_token; 48 gpu::SyncToken sync_token;
52 ASSERT_TRUE(context_->genSyncTokenCHROMIUM(fence_sync, sync_token.GetData())); 49 gl_->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
53 50
54 TestSignalSyncToken(sync_token); 51 TestSignalSyncToken(sync_token);
55 }; 52 };
56 53
57 CONTEXT_TEST_F(SignalTest, EmptySignalSyncTokenTest) { 54 CONTEXT_TEST_F(SignalTest, EmptySignalSyncTokenTest) {
58 if (!context_)
59 return;
60
61 // Signalling something that doesn't exist should run the callback 55 // Signalling something that doesn't exist should run the callback
62 // immediately. 56 // immediately.
63 gpu::SyncToken sync_token; 57 gpu::SyncToken sync_token;
64 TestSignalSyncToken(sync_token); 58 TestSignalSyncToken(sync_token);
65 }; 59 };
66 60
67 CONTEXT_TEST_F(SignalTest, InvalidSignalSyncTokenTest) { 61 CONTEXT_TEST_F(SignalTest, InvalidSignalSyncTokenTest) {
68 if (!context_)
69 return;
70
71 // Signalling something that doesn't exist should run the callback 62 // Signalling something that doesn't exist should run the callback
72 // immediately. 63 // immediately.
73 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, 64 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0,
74 gpu::CommandBufferId::FromUnsafeValue(1297824234), 65 gpu::CommandBufferId::FromUnsafeValue(1297824234),
75 9123743439); 66 9123743439);
76 TestSignalSyncToken(sync_token); 67 TestSignalSyncToken(sync_token);
77 }; 68 };
78 69
79 CONTEXT_TEST_F(SignalTest, BasicSignalQueryTest) { 70 CONTEXT_TEST_F(SignalTest, BasicSignalQueryTest) {
80 if (!context_) 71 unsigned query;
81 return; 72 gl_->GenQueriesEXT(1, &query);
82 73 gl_->BeginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM, query);
83 unsigned query = context_->createQueryEXT(); 74 gl_->Finish();
84 context_->beginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM, query); 75 gl_->EndQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM);
85 context_->finish();
86 context_->endQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM);
87 TestSignalQuery(query); 76 TestSignalQuery(query);
88 context_->deleteQueryEXT(query); 77 gl_->DeleteQueriesEXT(1, &query);
89 }; 78 };
90 79
91 CONTEXT_TEST_F(SignalTest, SignalQueryUnboundTest) { 80 CONTEXT_TEST_F(SignalTest, SignalQueryUnboundTest) {
92 if (!context_) 81 GLuint query;
93 return; 82 gl_->GenQueriesEXT(1, &query);
94
95 blink::WebGLId query = context_->createQueryEXT();
96 TestSignalQuery(query); 83 TestSignalQuery(query);
97 context_->deleteQueryEXT(query); 84 gl_->DeleteQueriesEXT(1, &query);
98 }; 85 };
99 86
100 CONTEXT_TEST_F(SignalTest, InvalidSignalQueryUnboundTest) { 87 CONTEXT_TEST_F(SignalTest, InvalidSignalQueryUnboundTest) {
101 if (!context_)
102 return;
103
104 // Signalling something that doesn't exist should run the callback 88 // Signalling something that doesn't exist should run the callback
105 // immediately. 89 // immediately.
106 TestSignalQuery(928729087); 90 TestSignalQuery(928729087);
107 TestSignalQuery(928729086); 91 TestSignalQuery(928729086);
108 TestSignalQuery(928729085); 92 TestSignalQuery(928729085);
109 TestSignalQuery(928729083); 93 TestSignalQuery(928729083);
110 TestSignalQuery(928729082); 94 TestSignalQuery(928729082);
111 TestSignalQuery(928729081); 95 TestSignalQuery(928729081);
112 }; 96 };
113 97
114 }; 98 };
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_ipc_browsertests.cc ('k') | content/common/gpu/client/gpu_in_process_context_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698