cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / gpu / command_buffer / common / gles2_cmd_format_test.cc
blob396ccb3e2d76487bf003ba979eddfabe91123d55
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
3 // found in the LICENSE file.
5 // This file contains unit tests for gles2 commmands
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "gpu/command_buffer/common/gles2_cmd_format.h"
10 namespace gpu {
11 namespace gles2 {
13 class GLES2FormatTest : public testing::Test {
14 protected:
15 static const unsigned char kInitialValue = 0xBD;
17 virtual void SetUp() {
18 memset(buffer_, kInitialValue, sizeof(buffer_));
21 virtual void TearDown() {
24 template <typename T>
25 T* GetBufferAs() {
26 return static_cast<T*>(static_cast<void*>(&buffer_));
29 void CheckBytesWritten(
30 const void* end, size_t expected_size, size_t written_size) {
31 size_t actual_size = static_cast<const unsigned char*>(end) -
32 GetBufferAs<const unsigned char>();
33 EXPECT_LT(actual_size, sizeof(buffer_));
34 EXPECT_GT(actual_size, 0u);
35 EXPECT_EQ(expected_size, actual_size);
36 EXPECT_EQ(kInitialValue, buffer_[written_size]);
37 EXPECT_NE(kInitialValue, buffer_[written_size - 1]);
40 void CheckBytesWrittenMatchesExpectedSize(
41 const void* end, size_t expected_size) {
42 CheckBytesWritten(end, expected_size, expected_size);
45 private:
46 unsigned char buffer_[1024];
49 // GCC requires these declarations, but MSVC requires they not be present
50 #ifndef _MSC_VER
51 const unsigned char GLES2FormatTest::kInitialValue;
52 #endif
54 #include "gpu/command_buffer/common/gles2_cmd_format_test_autogen.h"
56 } // namespace gles2
57 } // namespace gpu