OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "FakeWebGraphicsContext3D.h" | 7 #include "FakeWebGraphicsContext3D.h" |
8 #include <gmock/gmock.h> | 8 #include "testing/gmock/include/gmock/gmock.h" |
9 #include <gtest/gtest.h> | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include <wtf/OwnPtr.h> | 10 #include <wtf/OwnPtr.h> |
11 #include <wtf/PassOwnPtr.h> | 11 #include <wtf/PassOwnPtr.h> |
12 | 12 |
13 using namespace WebCore; | 13 using namespace WebCore; |
14 using namespace WebKit; | 14 using namespace WebKit; |
15 | 15 |
16 class ContextThatCountsMakeCurrents : public FakeWebGraphicsContext3D { | 16 class ContextThatCountsMakeCurrents : public FakeWebGraphicsContext3D { |
17 public: | 17 public: |
18 ContextThatCountsMakeCurrents() : m_makeCurrentCount(0) { } | 18 ContextThatCountsMakeCurrents() : m_makeCurrentCount(0) { } |
19 virtual bool makeContextCurrent() | 19 virtual bool makeContextCurrent() |
20 { | 20 { |
21 m_makeCurrentCount++; | 21 m_makeCurrentCount++; |
22 return true; | 22 return true; |
23 } | 23 } |
24 int makeCurrentCount() { return m_makeCurrentCount; } | 24 int makeCurrentCount() { return m_makeCurrentCount; } |
25 private: | 25 private: |
26 int m_makeCurrentCount; | 26 int m_makeCurrentCount; |
27 }; | 27 }; |
28 | 28 |
29 | 29 |
30 TEST(FakeGraphicsContext3DTest, ContextCreationShouldNotMakeCurrent) | 30 TEST(FakeGraphicsContext3DTest, ContextCreationShouldNotMakeCurrent) |
31 { | 31 { |
32 OwnPtr<ContextThatCountsMakeCurrents> context(adoptPtr(new ContextThatCounts
MakeCurrents)); | 32 OwnPtr<ContextThatCountsMakeCurrents> context(adoptPtr(new ContextThatCounts
MakeCurrents)); |
33 EXPECT_TRUE(context); | 33 EXPECT_TRUE(context); |
34 EXPECT_EQ(0, context->makeCurrentCount()); | 34 EXPECT_EQ(0, context->makeCurrentCount()); |
35 } | 35 } |
OLD | NEW |