Flutter Linux Embedder
fl_display_monitor_test.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
6 #include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h"
8 
9 #include "flutter/shell/platform/linux/testing/linux_test.h"
10 #include "gtest/gtest.h"
11 
12 class FlDisplayMonitorTest : public flutter::testing::LinuxTest {};
13 
15  StartEngine();
16 
17  bool called = false;
18  fl_engine_get_embedder_api(engine)->NotifyDisplayUpdate = MOCK_ENGINE_PROC(
19  NotifyDisplayUpdate,
20  ([&called](auto engine, FlutterEngineDisplaysUpdateType update_type,
21  const FlutterEngineDisplay* displays, size_t displays_length) {
22  called = true;
23 
24  EXPECT_EQ(displays_length, 1u);
25 
26  return kSuccess;
27  }));
28 
29  g_autoptr(FlDisplayMonitor) monitor =
30  fl_display_monitor_new(engine, gdk_display_get_default());
31  EXPECT_FALSE(called);
32  fl_display_monitor_start(monitor);
33  EXPECT_TRUE(called);
34 }
g_autoptr(FlEngine) engine
void fl_display_monitor_start(FlDisplayMonitor *self)
FlDisplayMonitor * fl_display_monitor_new(FlEngine *engine, GdkDisplay *display)
TEST_F(FlDisplayMonitorTest, Test)
FlutterEngineProcTable * fl_engine_get_embedder_api(FlEngine *self)
Definition: fl_engine.cc:920