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

Unified Diff: cc/texture_update_controller_unittest.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address code review comments and fix all cc_unittests Created 8 years, 2 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
Index: cc/texture_update_controller_unittest.cc
diff --git a/cc/texture_update_controller_unittest.cc b/cc/texture_update_controller_unittest.cc
index 36677c4608d2caa0adff3d9232f6ffb720c33d88..aa15807c7dc9deb3add932d02e4dce31d10df497 100644
--- a/cc/texture_update_controller_unittest.cc
+++ b/cc/texture_update_controller_unittest.cc
@@ -7,6 +7,7 @@
#include "cc/texture_update_controller.h"
#include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread
+#include "cc/test/fake_proxy.h"
#include "cc/test/fake_web_compositor_output_surface.h"
#include "cc/test/fake_web_graphics_context_3d.h"
#include "cc/test/scheduler_test_common.h"
@@ -64,8 +65,9 @@ private:
class TextureUpdateControllerTest : public Test {
public:
TextureUpdateControllerTest()
- : m_queue(make_scoped_ptr(new TextureUpdateQueue))
- , m_textureManager(PrioritizedTextureManager::create(60*1024*1024, 1024, Renderer::ContentPool))
+ : m_proxy(0)
+ , m_queue(make_scoped_ptr(new TextureUpdateQueue))
+ , m_textureManager(PrioritizedTextureManager::create(60*1024*1024, 1024, Renderer::ContentPool, &m_proxy))
, m_compositorInitializer(m_thread.get())
, m_fullUploadCountExpected(0)
, m_partialCountExpected(0)
@@ -81,7 +83,7 @@ public:
~TextureUpdateControllerTest()
{
DebugScopedSetImplThreadAndMainThreadBlocked
- implThreadAndMainThreadBlocked;
+ implThreadAndMainThreadBlocked(&m_proxy);
m_textureManager->clearAllMemory(m_resourceProvider.get());
}
@@ -124,7 +126,6 @@ protected:
}
m_textureManager->prioritizeTextures();
- DebugScopedSetImplThread implThread;
m_resourceProvider = ResourceProvider::create(m_context.get());
}
@@ -171,18 +172,20 @@ protected:
void updateTextures()
{
DebugScopedSetImplThreadAndMainThreadBlocked
- implThreadAndMainThreadBlocked;
+ implThreadAndMainThreadBlocked(&m_proxy);
scoped_ptr<TextureUpdateController> updateController =
TextureUpdateController::create(
NULL,
- Proxy::implThread(),
+ m_proxy.implThread(),
m_queue.Pass(),
- m_resourceProvider.get());
+ m_resourceProvider.get(),
+ m_proxy.hasImplThread());
updateController->finalize();
}
protected:
// Classes required to interact and test the TextureUpdateController
+ FakeProxy m_proxy;
scoped_ptr<GraphicsContext> m_context;
scoped_ptr<ResourceProvider> m_resourceProvider;
scoped_ptr<TextureUpdateQueue> m_queue;
@@ -343,7 +346,7 @@ public:
protected:
FakeTextureUpdateController(cc::TextureUpdateControllerClient* client, cc::Thread* thread, scoped_ptr<TextureUpdateQueue> queue, ResourceProvider* resourceProvider)
- : cc::TextureUpdateController(client, thread, queue.Pass(), resourceProvider)
+ : cc::TextureUpdateController(client, thread, queue.Pass(), resourceProvider, false)
, m_updateMoreTexturesSize(0) { }
base::TimeTicks m_now;
@@ -368,7 +371,7 @@ TEST_F(TextureUpdateControllerTest, UpdateMoreTextures)
appendPartialUploadsToUpdateQueue(0);
DebugScopedSetImplThreadAndMainThreadBlocked
- implThreadAndMainThreadBlocked;
+ implThreadAndMainThreadBlocked(&m_proxy);
scoped_ptr<FakeTextureUpdateController> controller(FakeTextureUpdateController::create(&client, &thread, m_queue.Pass(), m_resourceProvider.get()));
controller->setNow(
@@ -414,7 +417,7 @@ TEST_F(TextureUpdateControllerTest, NoMoreUpdates)
appendPartialUploadsToUpdateQueue(0);
DebugScopedSetImplThreadAndMainThreadBlocked
- implThreadAndMainThreadBlocked;
+ implThreadAndMainThreadBlocked(&m_proxy);
scoped_ptr<FakeTextureUpdateController> controller(FakeTextureUpdateController::create(&client, &thread, m_queue.Pass(), m_resourceProvider.get()));
controller->setNow(
@@ -454,7 +457,7 @@ TEST_F(TextureUpdateControllerTest, UpdatesCompleteInFiniteTime)
appendPartialUploadsToUpdateQueue(0);
DebugScopedSetImplThreadAndMainThreadBlocked
- implThreadAndMainThreadBlocked;
+ implThreadAndMainThreadBlocked(&m_proxy);
scoped_ptr<FakeTextureUpdateController> controller(FakeTextureUpdateController::create(&client, &thread, m_queue.Pass(), m_resourceProvider.get()));
controller->setNow(

Powered by Google App Engine
This is Rietveld 408576698