Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: webkit/compositor/ThrottledTextureUploaderTest.cpp

Issue 10920056: Make cc_unittests and webkit_compositor_unittests executable always (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename to webkit_compositor_bindings Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2012 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.
4
5 #include "config.h"
6
7 #include "ThrottledTextureUploader.h"
8
9 #include "Extensions3DChromium.h"
10 #include "FakeWebGraphicsContext3D.h"
11 #include "GraphicsContext3D.h"
12
13 #include <gmock/gmock.h>
14 #include <gtest/gtest.h>
15 #include <wtf/RefPtr.h>
16
17 using namespace WebCore;
18 using namespace WebKit;
19
20 namespace {
21
22 class FakeWebGraphicsContext3DWithQueryTesting : public FakeWebGraphicsContext3D {
23 public:
24 FakeWebGraphicsContext3DWithQueryTesting() : m_resultAvailable(0)
25 {
26 }
27
28 virtual void getQueryObjectuivEXT(WebGLId, GC3Denum type, GC3Duint* value)
29 {
30 switch (type) {
31 case Extensions3DChromium::QUERY_RESULT_AVAILABLE_EXT:
32 *value = m_resultAvailable;
33 break;
34 default:
35 *value = 0;
36 break;
37 }
38 }
39
40 void setResultAvailable(unsigned resultAvailable) { m_resultAvailable = resu ltAvailable; }
41
42 private:
43 unsigned m_resultAvailable;
44 };
45
46 TEST(ThrottledTextureUploaderTest, IsBusy)
47 {
48 OwnPtr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(adoptPtr(new Fa keWebGraphicsContext3DWithQueryTesting));
49 OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create (fakeContext.get(), 2);
50
51 fakeContext->setResultAvailable(0);
52 EXPECT_FALSE(uploader->isBusy());
53 uploader->beginUploads();
54 uploader->endUploads();
55 EXPECT_FALSE(uploader->isBusy());
56 uploader->beginUploads();
57 uploader->endUploads();
58 EXPECT_TRUE(uploader->isBusy());
59
60 fakeContext->setResultAvailable(1);
61 EXPECT_FALSE(uploader->isBusy());
62 uploader->beginUploads();
63 uploader->endUploads();
64 EXPECT_FALSE(uploader->isBusy());
65 uploader->beginUploads();
66 uploader->endUploads();
67 EXPECT_FALSE(uploader->isBusy());
68 uploader->beginUploads();
69 uploader->endUploads();
70 }
71
72 } // namespace
OLDNEW
« no previous file with comments | « webkit/compositor/TextureLayerChromiumTest.cpp ('k') | webkit/compositor/TiledLayerChromiumTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698