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