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

Unified Diff: cc/surfaces/surface_factory_unittest.cc

Issue 812543002: Update from https://crrev.com/308331 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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/surfaces/surface_factory.cc ('k') | cc/surfaces/surfaces_pixeltest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_factory_unittest.cc
diff --git a/cc/surfaces/surface_factory_unittest.cc b/cc/surfaces/surface_factory_unittest.cc
index 84dcc5e2e481961144f6062e18a7e15fa98e4476..1a87c0f9c4e203aa8b60a30aa654a3284517c71e 100644
--- a/cc/surfaces/surface_factory_unittest.cc
+++ b/cc/surfaces/surface_factory_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/bind.h"
#include "cc/output/compositor_frame.h"
#include "cc/output/delegated_frame_data.h"
#include "cc/surfaces/surface.h"
@@ -58,7 +59,8 @@ class SurfaceFactoryTest : public testing::Test {
}
scoped_ptr<CompositorFrame> frame(new CompositorFrame);
frame->delegated_frame_data = frame_data.Pass();
- factory_.SubmitFrame(surface_id_, frame.Pass(), base::Closure());
+ factory_.SubmitFrame(surface_id_, frame.Pass(),
+ SurfaceFactory::DrawCallback());
}
void UnrefResources(ResourceProvider::ResourceId* ids_to_unref,
@@ -358,6 +360,11 @@ TEST_F(SurfaceFactoryTest, ResourceLifetime) {
}
}
+void DrawCallback(bool* executed, bool* result, bool drawn) {
+ *executed = true;
+ *result = drawn;
+}
+
// Tests doing a DestroyAll before shutting down the factory;
TEST_F(SurfaceFactoryTest, DestroyAll) {
SurfaceId id(7);
@@ -370,10 +377,17 @@ TEST_F(SurfaceFactoryTest, DestroyAll) {
frame_data->resource_list.push_back(resource);
scoped_ptr<CompositorFrame> frame(new CompositorFrame);
frame->delegated_frame_data = frame_data.Pass();
- factory_.SubmitFrame(id, frame.Pass(), base::Closure());
+ bool executed = false;
+ bool drawn = false;
+
+ factory_.SubmitFrame(id, frame.Pass(),
+ base::Bind(&DrawCallback, &executed, &drawn));
surface_id_ = SurfaceId();
+ EXPECT_FALSE(executed);
factory_.DestroyAll();
+ EXPECT_TRUE(executed);
+ EXPECT_FALSE(drawn);
}
TEST_F(SurfaceFactoryTest, DestroySequence) {
@@ -391,7 +405,8 @@ TEST_F(SurfaceFactoryTest, DestroySequence) {
frame->metadata.satisfies_sequences.push_back(4);
frame->delegated_frame_data = frame_data.Pass();
DCHECK(manager_.GetSurfaceForId(id2));
- factory_.SubmitFrame(surface_id_, frame.Pass(), base::Closure());
+ factory_.SubmitFrame(surface_id_, frame.Pass(),
+ SurfaceFactory::DrawCallback());
DCHECK(!manager_.GetSurfaceForId(id2));
// Check that waiting after the sequence is satisfied works.
« no previous file with comments | « cc/surfaces/surface_factory.cc ('k') | cc/surfaces/surfaces_pixeltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698