OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file contains unit tests for gles2 commmands | 5 // This file contains unit tests for gles2 commmands |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" |
| 11 #include "base/single_thread_task_runner.h" |
10 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
11 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "gpu/command_buffer/common/gles2_cmd_format.h" | |
14 | 16 |
15 namespace gpu { | 17 namespace gpu { |
16 namespace gles2 { | 18 namespace gles2 { |
17 | 19 |
18 class GLES2FormatTest : public testing::Test { | 20 class GLES2FormatTest : public testing::Test { |
19 protected: | 21 protected: |
20 static const unsigned char kInitialValue = 0xBD; | 22 static const unsigned char kInitialValue = 0xBD; |
21 | 23 |
22 void SetUp() override { memset(buffer_, kInitialValue, sizeof(buffer_)); } | 24 void SetUp() override { memset(buffer_, kInitialValue, sizeof(buffer_)); } |
23 | 25 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // Next token, skip 0. | 89 // Next token, skip 0. |
88 async_token++; | 90 async_token++; |
89 if (async_token == 0) | 91 if (async_token == 0) |
90 async_token++; | 92 async_token++; |
91 | 93 |
92 // Set the buffer's associated token. | 94 // Set the buffer's associated token. |
93 buffer_tokens[buffer] = async_token; | 95 buffer_tokens[buffer] = async_token; |
94 | 96 |
95 // Set the async upload token on the fake upload thread and assert that | 97 // Set the async upload token on the fake upload thread and assert that |
96 // the associated buffer still has the given token. | 98 // the associated buffer still has the given token. |
97 thread.message_loop()->PostTask(FROM_HERE, | 99 thread.task_runner()->PostTask( |
98 base::Bind(&SignalCompletion, | 100 FROM_HERE, base::Bind(&SignalCompletion, &buffer_tokens[buffer], |
99 &buffer_tokens[buffer], | 101 async_token, &sync)); |
100 async_token, | |
101 &sync)); | |
102 } | 102 } |
103 | 103 |
104 // Flush the thread message loop before starting again. | 104 // Flush the thread message loop before starting again. |
105 base::WaitableEvent waitable(false, false); | 105 base::WaitableEvent waitable(false, false); |
106 thread.message_loop()->PostTask(FROM_HERE, | 106 thread.task_runner()->PostTask( |
107 base::Bind(&base::WaitableEvent::Signal, | 107 FROM_HERE, |
108 base::Unretained(&waitable))); | 108 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&waitable))); |
109 waitable.Wait(); | 109 waitable.Wait(); |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 // GCC requires these declarations, but MSVC requires they not be present | 113 // GCC requires these declarations, but MSVC requires they not be present |
114 #ifndef _MSC_VER | 114 #ifndef _MSC_VER |
115 const unsigned char GLES2FormatTest::kInitialValue; | 115 const unsigned char GLES2FormatTest::kInitialValue; |
116 #endif | 116 #endif |
117 | 117 |
118 #include "gpu/command_buffer/common/gles2_cmd_format_test_autogen.h" | 118 #include "gpu/command_buffer/common/gles2_cmd_format_test_autogen.h" |
119 | 119 |
120 } // namespace gles2 | 120 } // namespace gles2 |
121 } // namespace gpu | 121 } // namespace gpu |
122 | 122 |
OLD | NEW |