blob: 4767481ea6f5aecd7953f96f42ae90923ca4bf9b [file] [log] [blame]
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/flow/testing/mock_embedder.h"
namespace flutter {
namespace testing {
MockViewEmbedder::MockViewEmbedder() = default;
MockViewEmbedder::~MockViewEmbedder() = default;
void MockViewEmbedder::AddCanvas(SkCanvas* canvas) {
contexts_.emplace_back(EmbedderPaintContext{canvas, nullptr});
}
void MockViewEmbedder::AddRecorder(DisplayListCanvasRecorder* recorder) {
contexts_.emplace_back(
EmbedderPaintContext{recorder, recorder->builder().get()});
}
// |ExternalViewEmbedder|
SkCanvas* MockViewEmbedder::GetRootCanvas() {
return nullptr;
}
// |ExternalViewEmbedder|
void MockViewEmbedder::CancelFrame() {}
// |ExternalViewEmbedder|
void MockViewEmbedder::BeginFrame(
SkISize frame_size,
GrDirectContext* context,
double device_pixel_ratio,
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger) {}
// |ExternalViewEmbedder|
void MockViewEmbedder::PrerollCompositeEmbeddedView(
int view_id,
std::unique_ptr<EmbeddedViewParams> params) {}
// |ExternalViewEmbedder|
std::vector<SkCanvas*> MockViewEmbedder::GetCurrentCanvases() {
return std::vector<SkCanvas*>({});
}
// |ExternalViewEmbedder|
std::vector<DisplayListBuilder*> MockViewEmbedder::GetCurrentBuilders() {
return std::vector<DisplayListBuilder*>({});
}
// |ExternalViewEmbedder|
EmbedderPaintContext MockViewEmbedder::CompositeEmbeddedView(int view_id) {
EmbedderPaintContext context = contexts_.front();
contexts_.pop_front();
return context;
}
} // namespace testing
} // namespace flutter