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

Unified Diff: components/exo/surface_unittest.cc

Issue 2083853002: exo: Recreate Surface resources on context lost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits Created 4 years, 6 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 | « components/exo/surface.cc ('k') | content/browser/compositor/gpu_process_transport_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/surface_unittest.cc
diff --git a/components/exo/surface_unittest.cc b/components/exo/surface_unittest.cc
index fc5c58f8a6799ae5eba9768d45cc85b7245c360e..6c7ca96819c55eeafba52e841726ef75c13a6185 100644
--- a/components/exo/surface_unittest.cc
+++ b/components/exo/surface_unittest.cc
@@ -3,11 +3,16 @@
// 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"
+#include "cc/surfaces/surface_manager.h"
#include "components/exo/buffer.h"
#include "components/exo/surface.h"
#include "components/exo/test/exo_test_base.h"
#include "components/exo/test/exo_test_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/aura/env.h"
#include "ui/compositor/layer_tree_owner.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/wm/core/window_util.h"
@@ -182,6 +187,15 @@ TEST_F(SurfaceTest, SetCrop) {
EXPECT_EQ(crop_size.ToString(), surface->content_size().ToString());
}
+const cc::DelegatedFrameData* GetFrameFromSurface(Surface* surface) {
+ cc::SurfaceId surface_id = surface->surface_id();
+ cc::SurfaceManager* surface_manager =
+ aura::Env::GetInstance()->context_factory()->GetSurfaceManager();
+ const cc::CompositorFrame* frame =
+ surface_manager->GetSurfaceForId(surface_id)->GetEligibleFrame();
+ return frame->delegated_frame_data.get();
+}
+
TEST_F(SurfaceTest, SetBlendMode) {
gfx::Size buffer_size(1, 1);
std::unique_ptr<Buffer> buffer(
@@ -192,7 +206,14 @@ TEST_F(SurfaceTest, SetBlendMode) {
surface->SetBlendMode(SkXfermode::kSrc_Mode);
surface->Commit();
- EXPECT_TRUE(surface->window()->layer()->fills_bounds_opaquely());
+ EXPECT_FALSE(surface->window()->layer()->fills_bounds_opaquely());
+
+ const cc::DelegatedFrameData* frame_data = GetFrameFromSurface(surface.get());
+ ASSERT_EQ(1u, frame_data->render_pass_list.size());
+ ASSERT_EQ(1u, frame_data->render_pass_list.back()->quad_list.size());
+ EXPECT_FALSE(frame_data->render_pass_list.back()
+ ->quad_list.back()
+ ->ShouldDrawWithBlending());
}
TEST_F(SurfaceTest, SetAlpha) {
« no previous file with comments | « components/exo/surface.cc ('k') | content/browser/compositor/gpu_process_transport_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698