summaryrefslogtreecommitdiffstats
path: root/cc/trees/layer_tree_host_unittest_context.cc
diff options
context:
space:
mode:
authornkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-28 17:57:32 +0000
committernkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-28 17:57:32 +0000
commitdfbded2d19eea373728491177ddfab62f79b6bce (patch)
treee74919f3d6124e47f7aa670c1c8386042226d910 /cc/trees/layer_tree_host_unittest_context.cc
parenta02439a8031557d1201383ff170aef4869996cbd (diff)
downloadchromium_src-dfbded2d19eea373728491177ddfab62f79b6bce.zip
chromium_src-dfbded2d19eea373728491177ddfab62f79b6bce.tar.gz
chromium_src-dfbded2d19eea373728491177ddfab62f79b6bce.tar.bz2
Revert 280493 "Make SingleThreadProxy a SchedulerClient"
Reason for revert: Check if this CL breaks TouchActionBrowserTest.TouchActionNone test http://goo.gl/pwdNwL Also it was reported that this CL causing a number of crashes on the blink bots, e.g., http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel > Make SingleThreadProxy a SchedulerClient > > This makes ui::Compositor no longer in charge of > scheduling commits and draws, deferring it to cc::Scheduler. > > BUG=329552, 287250 > > Review URL: https://codereview.chromium.org/134623005 TBR=enne@chromium.org Review URL: https://codereview.chromium.org/359103004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280521 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/trees/layer_tree_host_unittest_context.cc')
-rw-r--r--cc/trees/layer_tree_host_unittest_context.cc80
1 files changed, 46 insertions, 34 deletions
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index 548ff36..879e534 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -65,9 +65,6 @@ 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;
@@ -203,53 +200,45 @@ class LayerTreeHostContextTestLostContextSucceeds
static const TestCase kTests[] = {
// Losing the context and failing to recreate it (or losing it again
// immediately) a small number of times should succeed.
- {
- 1, // times_to_lose_during_commit
+ {1, // times_to_lose_during_commit
0, // times_to_lose_during_draw
0, // times_to_fail_recreate
false, // fallback_context_works
},
- {
- 0, // times_to_lose_during_commit
+ {0, // times_to_lose_during_commit
1, // times_to_lose_during_draw
0, // times_to_fail_recreate
false, // fallback_context_works
},
- {
- 1, // times_to_lose_during_commit
+ {1, // times_to_lose_during_commit
0, // times_to_lose_during_draw
3, // times_to_fail_recreate
false, // fallback_context_works
},
- {
- 0, // times_to_lose_during_commit
+ {0, // times_to_lose_during_commit
1, // times_to_lose_during_draw
3, // times_to_fail_recreate
false, // fallback_context_works
},
// Losing the context and recreating it any number of times should
// succeed.
- {
- 10, // times_to_lose_during_commit
+ {10, // times_to_lose_during_commit
0, // times_to_lose_during_draw
0, // times_to_fail_recreate
false, // fallback_context_works
},
- {
- 0, // times_to_lose_during_commit
+ {0, // times_to_lose_during_commit
10, // times_to_lose_during_draw
0, // times_to_fail_recreate
false, // fallback_context_works
},
// Losing the context, failing to reinitialize it, and making a fallback
// context should work.
- {
- 0, // times_to_lose_during_commit
+ {0, // times_to_lose_during_commit
1, // times_to_lose_during_draw
0, // times_to_fail_recreate
true, // fallback_context_works
- },
- };
+ }, };
if (test_case_ >= arraysize(kTests))
return false;
@@ -311,8 +300,7 @@ class LayerTreeHostClientNotReadyDoesNotCreateOutputSurface
}
};
-SINGLE_AND_MULTI_THREAD_TEST_F(
- LayerTreeHostClientNotReadyDoesNotCreateOutputSurface);
+MULTI_THREAD_TEST_F(LayerTreeHostClientNotReadyDoesNotCreateOutputSurface);
class LayerTreeHostContextTestLostContextSucceedsWithContent
: public LayerTreeHostContextTestLostContextSucceeds {
@@ -370,11 +358,10 @@ class LayerTreeHostContextTestCreateOutputSurfaceFails
: times_to_fail_(times_to_fail),
expect_fallback_attempt_(expect_fallback_attempt),
did_attempt_fallback_(false),
- times_initialized_(0) {
- times_to_fail_create_ = times_to_fail_;
- }
+ times_initialized_(0) {}
virtual void BeginTest() OVERRIDE {
+ times_to_fail_create_ = times_to_fail_;
PostSetNeedsCommitToMainThread();
}
@@ -988,6 +975,12 @@ 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();
}
@@ -1031,10 +1024,12 @@ class UIResourceLostTest : public LayerTreeHostContextTest {
void PostLoseContextToImplThread() {
EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
- ImplThreadTaskRunner()->PostTask(
- FROM_HERE,
- base::Bind(&LayerTreeHostContextTest::LoseContext,
- base::Unretained(this)));
+ base::SingleThreadTaskRunner* task_runner =
+ HasImplThread() ? ImplThreadTaskRunner()
+ : base::MessageLoopProxy::current();
+ task_runner->PostTask(FROM_HERE,
+ base::Bind(&LayerTreeHostContextTest::LoseContext,
+ base::Unretained(this)));
}
protected:
@@ -1089,8 +1084,13 @@ class UIResourceLostAfterCommit : public UIResourceLostTestSimple {
EndTest();
break;
case 5:
- NOTREACHED();
+ // Single thread proxy issues extra commits after context lost.
+ // http://crbug.com/287250
+ if (HasImplThread())
+ NOTREACHED();
break;
+ case 6:
+ NOTREACHED();
}
}
@@ -1178,8 +1178,13 @@ class UIResourceLostBeforeCommit : public UIResourceLostTestSimple {
EndTest();
break;
case 6:
- NOTREACHED();
+ // Single thread proxy issues extra commits after context lost.
+ // http://crbug.com/287250
+ if (HasImplThread())
+ NOTREACHED();
break;
+ case 8:
+ NOTREACHED();
}
}
@@ -1200,8 +1205,15 @@ class UIResourceLostBeforeCommit : public UIResourceLostTestSimple {
// Sequence 2 (continued):
// The previous resource should have been deleted.
EXPECT_EQ(0u, impl->ResourceIdForUIResource(test_id0_));
- // The second resource should have been created.
- EXPECT_NE(0u, impl->ResourceIdForUIResource(test_id1_));
+ 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 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);
@@ -1517,8 +1529,8 @@ class LayerTreeHostContextTestLoseAfterSendingBeginMainFrame
bool deferred_;
};
-SINGLE_AND_MULTI_THREAD_TEST_F(
- LayerTreeHostContextTestLoseAfterSendingBeginMainFrame);
+// TODO(danakj): We don't use scheduler with SingleThreadProxy yet.
+MULTI_THREAD_TEST_F(LayerTreeHostContextTestLoseAfterSendingBeginMainFrame);
} // namespace
} // namespace cc