| OLD | NEW |
| 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" |
| 11 #include "gpu/GLES2/gl2extchromium.h" | 11 #include "gpu/GLES2/gl2extchromium.h" |
| 12 #include "gpu/command_buffer/client/context_support.h" | 12 #include "gpu/command_buffer/client/context_support.h" |
| 13 #include "gpu/command_buffer/common/sync_token.h" |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 class SignalTest : public ContextTestBase { | 17 class SignalTest : public ContextTestBase { |
| 17 public: | 18 public: |
| 18 static void RunOnlyOnce(base::Closure cb, int* tmp) { | 19 static void RunOnlyOnce(base::Closure cb, int* tmp) { |
| 19 CHECK_EQ(*tmp, 0); | 20 CHECK_EQ(*tmp, 0); |
| 20 ++*tmp; | 21 ++*tmp; |
| 21 cb.Run(); | 22 cb.Run(); |
| 22 } | 23 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 36 base::Bind( | 37 base::Bind( |
| 37 &RunOnlyOnce, run_loop.QuitClosure(), base::Owned(new int(0)))); | 38 &RunOnlyOnce, run_loop.QuitClosure(), base::Owned(new int(0)))); |
| 38 run_loop.Run(); | 39 run_loop.Run(); |
| 39 } | 40 } |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 CONTEXT_TEST_F(SignalTest, BasicSignalSyncPointTest) { | 43 CONTEXT_TEST_F(SignalTest, BasicSignalSyncPointTest) { |
| 43 if (!context_) | 44 if (!context_) |
| 44 return; | 45 return; |
| 45 | 46 |
| 46 TestSignalSyncPoint(context_->insertSyncPoint()); | 47 gpu::SyncToken sync_token; |
| 48 ASSERT_TRUE(context_->insertSyncPoint(sync_token.GetData())); |
| 49 TestSignalSyncPoint(static_cast<unsigned>(sync_token.release_count())); |
| 47 }; | 50 }; |
| 48 | 51 |
| 49 CONTEXT_TEST_F(SignalTest, InvalidSignalSyncPointTest) { | 52 CONTEXT_TEST_F(SignalTest, InvalidSignalSyncPointTest) { |
| 50 if (!context_) | 53 if (!context_) |
| 51 return; | 54 return; |
| 52 | 55 |
| 53 // Signalling something that doesn't exist should run the callback | 56 // Signalling something that doesn't exist should run the callback |
| 54 // immediately. | 57 // immediately. |
| 55 TestSignalSyncPoint(1297824234); | 58 TestSignalSyncPoint(1297824234); |
| 56 }; | 59 }; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 84 // immediately. | 87 // immediately. |
| 85 TestSignalQuery(928729087); | 88 TestSignalQuery(928729087); |
| 86 TestSignalQuery(928729086); | 89 TestSignalQuery(928729086); |
| 87 TestSignalQuery(928729085); | 90 TestSignalQuery(928729085); |
| 88 TestSignalQuery(928729083); | 91 TestSignalQuery(928729083); |
| 89 TestSignalQuery(928729082); | 92 TestSignalQuery(928729082); |
| 90 TestSignalQuery(928729081); | 93 TestSignalQuery(928729081); |
| 91 }; | 94 }; |
| 92 | 95 |
| 93 }; | 96 }; |
| OLD | NEW |