Flutter Engine
dart_vm_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/runtime/dart_vm.h"
6 
7 #include "flutter/runtime/dart_vm_lifecycle.h"
8 #include "flutter/testing/fixture_test.h"
9 #include "gtest/gtest.h"
10 
11 namespace flutter {
12 namespace testing {
13 
15 
16 TEST_F(DartVMTest, SimpleInitialization) {
17  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
18  auto vm = DartVMRef::Create(CreateSettingsForFixture());
19  ASSERT_TRUE(vm);
20 }
21 
22 TEST_F(DartVMTest, SimpleIsolateNameServer) {
23  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
24  auto vm = DartVMRef::Create(CreateSettingsForFixture());
25  ASSERT_TRUE(vm);
26  ASSERT_TRUE(vm.GetVMData());
27  auto ns = vm->GetIsolateNameServer();
28  ASSERT_EQ(ns->LookupIsolatePortByName("foobar"), ILLEGAL_PORT);
29  ASSERT_FALSE(ns->RemoveIsolateNameMapping("foobar"));
30  ASSERT_TRUE(ns->RegisterIsolatePortWithName(123, "foobar"));
31  ASSERT_FALSE(ns->RegisterIsolatePortWithName(123, "foobar"));
32  ASSERT_EQ(ns->LookupIsolatePortByName("foobar"), 123);
33  ASSERT_TRUE(ns->RemoveIsolateNameMapping("foobar"));
34 }
35 
36 TEST_F(DartVMTest, OldGenHeapSize) {
37  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
38  auto settings = CreateSettingsForFixture();
39  settings.old_gen_heap_size = 1024;
40  auto vm = DartVMRef::Create(settings);
41  // There is no way to introspect on the heap size so we just assert the vm was
42  // created.
43  ASSERT_TRUE(vm);
44 }
45 
46 } // namespace testing
47 } // namespace flutter
static bool IsInstanceRunning()
static DartVMRef Create(Settings settings, fml::RefPtr< DartSnapshot > vm_snapshot=nullptr, fml::RefPtr< DartSnapshot > isolate_snapshot=nullptr)
TEST_F(BackdropFilterLayerTest, PaintingEmptyLayerDies)