Flutter Engine
The Flutter Engine
flutter_window_controller_unittests.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
5#include "flutter/shell/platform/glfw/client_wrapper/include/flutter/flutter_window_controller.h"
6
7#include <memory>
8#include <string>
9
10#include "flutter/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h"
11#include "gtest/gtest.h"
12
13namespace flutter {
14
15namespace {
16
17// Stub implementation to validate calls to the API.
18class TestGlfwApi : public testing::StubFlutterGlfwApi {
19 public:
20 // |flutter::testing::StubFlutterGlfwApi|
21 bool Init() override {
22 init_called_ = true;
23 return true;
24 }
25
26 // |flutter::testing::StubFlutterGlfwApi|
27 void Terminate() override { terminate_called_ = true; }
28
29 bool init_called() { return init_called_; }
30
31 bool terminate_called() { return terminate_called_; }
32
33 private:
34 bool init_called_ = false;
35 bool terminate_called_ = false;
36};
37
38} // namespace
39
41 const std::string icu_data_path = "fake/path/to/icu";
43 std::make_unique<TestGlfwApi>());
44 auto test_api = static_cast<TestGlfwApi*>(scoped_api_stub.stub());
45 {
46 FlutterWindowController controller(icu_data_path);
47 EXPECT_EQ(test_api->init_called(), true);
48 EXPECT_EQ(test_api->terminate_called(), false);
49 }
50 EXPECT_EQ(test_api->init_called(), true);
51 EXPECT_EQ(test_api->terminate_called(), true);
52}
53
54} // namespace flutter
void Init()
TEST(FrameTimingsRecorderTest, RecordVsync)