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

Unified Diff: cc/layer_tree_host_unittest_context.cc

Issue 11941010: Fix scrollbars missing after lost context (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 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 | « no previous file | cc/scrollbar_layer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_unittest_context.cc
diff --git a/cc/layer_tree_host_unittest_context.cc b/cc/layer_tree_host_unittest_context.cc
index cf9da18e157841235735795b9c6e071adb73c733..e19b9d9596e1f0b095767f522c5fb44ca804af49 100644
--- a/cc/layer_tree_host_unittest_context.cc
+++ b/cc/layer_tree_host_unittest_context.cc
@@ -20,6 +20,7 @@
#include "cc/test/fake_content_layer_client.h"
#include "cc/test/fake_content_layer_impl.h"
#include "cc/test/fake_output_surface.h"
+#include "cc/test/fake_scrollbar_layer.h"
#include "cc/test/fake_scrollbar_theme_painter.h"
#include "cc/test/fake_video_frame_provider.h"
#include "cc/test/fake_web_graphics_context_3d.h"
@@ -30,6 +31,7 @@
#include "cc/texture_layer.h"
#include "cc/video_layer.h"
#include "cc/video_layer_impl.h"
+#include "gpu/GLES2/gl2extchromium.h"
#include "media/base/media.h"
using media::VideoFrame;
@@ -53,7 +55,8 @@ class LayerTreeHostContextTest : public ThreadedTest {
}
void LoseContext() {
- context3d_->loseContextCHROMIUM();
+ context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
+ GL_INNOCENT_CONTEXT_RESET_ARB);
context3d_ = NULL;
}
@@ -803,7 +806,8 @@ class LayerTreeHostContextTestFailsImmediately :
virtual scoped_ptr<FakeWebGraphicsContext3D> CreateContext3d() OVERRIDE {
scoped_ptr<FakeWebGraphicsContext3D> context =
LayerTreeHostContextTest::CreateContext3d();
- context->loseContextCHROMIUM();
+ context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
+ GL_INNOCENT_CONTEXT_RESET_ARB);
return context.Pass();
}
@@ -861,5 +865,53 @@ class LayerTreeHostContextTestImplSidePainting :
MULTI_THREAD_TEST_F(LayerTreeHostContextTestImplSidePainting)
+class ScrollbarLayerLostContext : public LayerTreeHostContextTest {
+ public:
+ ScrollbarLayerLostContext() : commits_(0) {}
+
+ virtual void beginTest() OVERRIDE {
+ scoped_refptr<Layer> scroll_layer = Layer::create();
+ scrollbar_layer_ = FakeScrollbarLayer::Create(
+ false, true, scroll_layer->id());
+ scrollbar_layer_->setBounds(gfx::Size(10, 100));
+ m_layerTreeHost->rootLayer()->addChild(scrollbar_layer_);
+ m_layerTreeHost->rootLayer()->addChild(scroll_layer);
+ postSetNeedsCommitToMainThread();
+ }
+
+ virtual void afterTest() OVERRIDE {
+ }
+
+ virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ ++commits_;
+ size_t upload_count = scrollbar_layer_->last_update_full_upload_size() +
+ scrollbar_layer_->last_update_partial_upload_size();
+ switch(commits_) {
+ case 1:
+ // First (regular) update, we should upload 2 resources (thumb, and
+ // backtrack).
+ EXPECT_EQ(1, scrollbar_layer_->update_count());
+ EXPECT_EQ(2, upload_count);
+ LoseContext();
+ break;
+ case 2:
+ // Second update, after the lost context, we should still upload 2
+ // resources even if the contents haven't changed.
+ EXPECT_EQ(2, scrollbar_layer_->update_count());
+ EXPECT_EQ(2, upload_count);
+ endTest();
+ break;
+ default:
+ NOTREACHED();
+ }
+ }
+
+ private:
+ int commits_;
+ scoped_refptr<FakeScrollbarLayer> scrollbar_layer_;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(ScrollbarLayerLostContext)
+
} // namespace
} // namespace cc
« no previous file with comments | « no previous file | cc/scrollbar_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698