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 <gmock/gmock.h> |
9 #include <gtest/gtest.h> | 9 #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 cc; |
13 using namespace WebCore; | 14 using namespace WebCore; |
14 using namespace WebKit; | 15 using namespace WebKit; |
15 | 16 |
16 class ContextThatCountsMakeCurrents : public FakeWebGraphicsContext3D { | 17 class ContextThatCountsMakeCurrents : public FakeWebGraphicsContext3D { |
17 public: | 18 public: |
18 ContextThatCountsMakeCurrents() : m_makeCurrentCount(0) { } | 19 ContextThatCountsMakeCurrents() : m_makeCurrentCount(0) { } |
19 virtual bool makeContextCurrent() | 20 virtual bool makeContextCurrent() |
20 { | 21 { |
21 m_makeCurrentCount++; | 22 m_makeCurrentCount++; |
22 return true; | 23 return true; |
23 } | 24 } |
24 int makeCurrentCount() { return m_makeCurrentCount; } | 25 int makeCurrentCount() { return m_makeCurrentCount; } |
25 private: | 26 private: |
26 int m_makeCurrentCount; | 27 int m_makeCurrentCount; |
27 }; | 28 }; |
28 | 29 |
29 | 30 |
30 TEST(FakeGraphicsContext3DTest, ContextCreationShouldNotMakeCurrent) | 31 TEST(FakeGraphicsContext3DTest, ContextCreationShouldNotMakeCurrent) |
31 { | 32 { |
32 OwnPtr<ContextThatCountsMakeCurrents> context(adoptPtr(new ContextThatCounts
MakeCurrents)); | 33 OwnPtr<ContextThatCountsMakeCurrents> context(adoptPtr(new ContextThatCounts
MakeCurrents)); |
33 EXPECT_TRUE(context); | 34 EXPECT_TRUE(context); |
34 EXPECT_EQ(0, context->makeCurrentCount()); | 35 EXPECT_EQ(0, context->makeCurrentCount()); |
35 } | 36 } |
36 | |
OLD | NEW |