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

Unified Diff: webkit/compositor/ThrottledTextureUploaderTest.cpp

Issue 10909020: Enable webkit_compositor_unittests (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/compositor/TextureLayerChromiumTest.cpp ('k') | webkit/compositor/TiledLayerChromiumTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/compositor/ThrottledTextureUploaderTest.cpp
diff --git a/webkit/compositor/ThrottledTextureUploaderTest.cpp b/webkit/compositor/ThrottledTextureUploaderTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..86b7a1076c32471115897f2417723b3d5b556d7d
--- /dev/null
+++ b/webkit/compositor/ThrottledTextureUploaderTest.cpp
@@ -0,0 +1,72 @@
+// Copyright 2012 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 "config.h"
+
+#include "ThrottledTextureUploader.h"
+
+#include "Extensions3DChromium.h"
+#include "FakeWebGraphicsContext3D.h"
+#include "GraphicsContext3D.h"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <wtf/RefPtr.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+namespace {
+
+class FakeWebGraphicsContext3DWithQueryTesting : public FakeWebGraphicsContext3D {
+public:
+ FakeWebGraphicsContext3DWithQueryTesting() : m_resultAvailable(0)
+ {
+ }
+
+ virtual void getQueryObjectuivEXT(WebGLId, GC3Denum type, GC3Duint* value)
+ {
+ switch (type) {
+ case Extensions3DChromium::QUERY_RESULT_AVAILABLE_EXT:
+ *value = m_resultAvailable;
+ break;
+ default:
+ *value = 0;
+ break;
+ }
+ }
+
+ void setResultAvailable(unsigned resultAvailable) { m_resultAvailable = resultAvailable; }
+
+private:
+ unsigned m_resultAvailable;
+};
+
+TEST(ThrottledTextureUploaderTest, IsBusy)
+{
+ OwnPtr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(adoptPtr(new FakeWebGraphicsContext3DWithQueryTesting));
+ OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create(fakeContext.get(), 2);
+
+ fakeContext->setResultAvailable(0);
+ EXPECT_FALSE(uploader->isBusy());
+ uploader->beginUploads();
+ uploader->endUploads();
+ EXPECT_FALSE(uploader->isBusy());
+ uploader->beginUploads();
+ uploader->endUploads();
+ EXPECT_TRUE(uploader->isBusy());
+
+ fakeContext->setResultAvailable(1);
+ EXPECT_FALSE(uploader->isBusy());
+ uploader->beginUploads();
+ uploader->endUploads();
+ EXPECT_FALSE(uploader->isBusy());
+ uploader->beginUploads();
+ uploader->endUploads();
+ EXPECT_FALSE(uploader->isBusy());
+ uploader->beginUploads();
+ uploader->endUploads();
+}
+
+} // namespace
« 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