summaryrefslogtreecommitdiffstats
path: root/cc/test/fake_graphics_context_3d_unittest.cc
blob: 01f1fbff72a7edef75f4f5cbef6493e03e9ec7e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "cc/test/fake_web_graphics_context_3d.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace cc {
namespace {

class ContextThatCountsMakeCurrents : public WebKit::FakeWebGraphicsContext3D {
public:
    ContextThatCountsMakeCurrents() : m_makeCurrentCount(0) { }
    virtual bool makeContextCurrent() OVERRIDE
    {
        m_makeCurrentCount++;
        return true;
    }
    int makeCurrentCount() const { return m_makeCurrentCount; }

private:
    int m_makeCurrentCount;
};


TEST(FakeGraphicsContext3DTest, ContextCreationShouldNotMakeCurrent)
{
    scoped_ptr<ContextThatCountsMakeCurrents> context(new ContextThatCountsMakeCurrents);
    EXPECT_TRUE(context.get());
    EXPECT_EQ(0, context->makeCurrentCount());
}

}  // namespace
}  // namespace cc