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

Unified Diff: cc/trees/layer_tree_host_unittest_context.cc

Issue 134623005: Make SingleThreadProxy a SchedulerClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add scoped_abort_remaining_swap_promises.h Created 6 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 | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_no_message_loop.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest_context.cc
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index 8fd9743f6d11a527018c6cab91265180ca68b2e3..887e603f1a15b3e53de338ad5916d34b03b0c15c 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -65,6 +65,9 @@ class LayerTreeHostContextTest : public LayerTreeTest {
}
void LoseContext() {
+ // For sanity-checking tests, they should only call this when the
+ // context is not lost.
+ CHECK(context3d_);
context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
GL_INNOCENT_CONTEXT_RESET_ARB);
context3d_ = NULL;
@@ -308,7 +311,8 @@ class LayerTreeHostClientNotReadyDoesNotCreateOutputSurface
}
};
-MULTI_THREAD_TEST_F(LayerTreeHostClientNotReadyDoesNotCreateOutputSurface);
+SINGLE_AND_MULTI_THREAD_TEST_F(
+ LayerTreeHostClientNotReadyDoesNotCreateOutputSurface);
class LayerTreeHostContextTestLostContextSucceedsWithContent
: public LayerTreeHostContextTestLostContextSucceeds {
@@ -366,10 +370,11 @@ class LayerTreeHostContextTestCreateOutputSurfaceFails
: times_to_fail_(times_to_fail),
expect_fallback_attempt_(expect_fallback_attempt),
did_attempt_fallback_(false),
- times_initialized_(0) {}
+ times_initialized_(0) {
+ times_to_fail_create_ = times_to_fail_;
+ }
virtual void BeginTest() OVERRIDE {
- times_to_fail_create_ = times_to_fail_;
PostSetNeedsCommitToMainThread();
}
@@ -983,12 +988,6 @@ class ScrollbarLayerLostContext : public LayerTreeHostContextTest {
EXPECT_EQ(2, scrollbar_layer_->update_count());
EndTest();
break;
- case 3:
- // Single thread proxy issues extra commits after context lost.
- // http://crbug.com/287250
- if (HasImplThread())
- NOTREACHED();
- break;
default:
NOTREACHED();
}
@@ -1032,12 +1031,10 @@ class UIResourceLostTest : public LayerTreeHostContextTest {
void PostLoseContextToImplThread() {
EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
- base::SingleThreadTaskRunner* task_runner =
- HasImplThread() ? ImplThreadTaskRunner()
- : base::MessageLoopProxy::current();
- task_runner->PostTask(FROM_HERE,
- base::Bind(&LayerTreeHostContextTest::LoseContext,
- base::Unretained(this)));
+ ImplThreadTaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(&LayerTreeHostContextTest::LoseContext,
+ base::Unretained(this)));
}
protected:
@@ -1092,13 +1089,8 @@ class UIResourceLostAfterCommit : public UIResourceLostTestSimple {
EndTest();
break;
case 5:
- // Single thread proxy issues extra commits after context lost.
- // http://crbug.com/287250
- if (HasImplThread())
- NOTREACHED();
- break;
- case 6:
NOTREACHED();
+ break;
}
}
@@ -1186,13 +1178,8 @@ class UIResourceLostBeforeCommit : public UIResourceLostTestSimple {
EndTest();
break;
case 6:
- // Single thread proxy issues extra commits after context lost.
- // http://crbug.com/287250
- if (HasImplThread())
- NOTREACHED();
- break;
- case 8:
NOTREACHED();
+ break;
}
}
@@ -1213,15 +1200,8 @@ class UIResourceLostBeforeCommit : public UIResourceLostTestSimple {
// Sequence 2 (continued):
// The previous resource should have been deleted.
EXPECT_EQ(0u, impl->ResourceIdForUIResource(test_id0_));
- if (HasImplThread()) {
- // The second resource should have been created.
- EXPECT_NE(0u, impl->ResourceIdForUIResource(test_id1_));
- } else {
- // The extra commit that happens at context lost in the single thread
- // proxy changes the timing so that the resource has been destroyed.
- // http://crbug.com/287250
- EXPECT_EQ(0u, impl->ResourceIdForUIResource(test_id1_));
- }
+ // The second resource should have been created.
+ EXPECT_NE(0u, impl->ResourceIdForUIResource(test_id1_));
// The second resource called the resource callback once and since the
// context is lost, a "resource lost" callback was also issued.
EXPECT_EQ(2, ui_resource_->resource_create_count);
@@ -1537,8 +1517,8 @@ class LayerTreeHostContextTestLoseAfterSendingBeginMainFrame
bool deferred_;
};
-// TODO(danakj): We don't use scheduler with SingleThreadProxy yet.
-MULTI_THREAD_TEST_F(LayerTreeHostContextTestLoseAfterSendingBeginMainFrame);
+SINGLE_AND_MULTI_THREAD_TEST_F(
+ LayerTreeHostContextTestLoseAfterSendingBeginMainFrame);
} // namespace
} // namespace cc
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_no_message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698