BUILD.gn 3.6 KB
Newer Older
M
Michael Goderbauer 已提交
1
# Copyright 2013 The Flutter Authors. All rights reserved.
2 3 4
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

5
import("//flutter/shell/config.gni")
6
import("testing.gni")
7

8
source_set("testing_lib") {
9 10
  testonly = true

11
  sources = [
12 13 14 15 16
    "assertions.h",
    "testing.cc",
    "testing.h",
    "thread_test.cc",
    "thread_test.h",
17 18 19
  ]

  public_deps = [
20
    "//flutter/fml",
21
    "//third_party/googletest:gtest",
22
  ]
23
  public_configs = [ "//flutter:config" ]
24
}
25

26 27 28 29
source_set("testing") {
  testonly = true

  sources = [
30 31
    "debugger_detection.cc",
    "debugger_detection.h",
32
    "run_all_unittests.cc",
33 34
    "test_timeout_listener.cc",
    "test_timeout_listener.h",
35 36 37 38 39 40 41
  ]

  public_deps = [
    ":testing_lib",
  ]
}

42 43 44 45
source_set("dart") {
  testonly = true

  sources = [
46
    "dart_isolate_runner.cc",
D
Dan Field 已提交
47
    "dart_isolate_runner.h",
48 49 50 51
    "elf_loader.cc",
    "elf_loader.h",
    "test_dart_native_resolver.cc",
    "test_dart_native_resolver.h",
52 53 54
  ]

  public_deps = [
55
    ":testing_lib",
56 57 58 59
    "//flutter/common",
    "//flutter/runtime",
    "//flutter/runtime:libdart",
    "//flutter/third_party/tonic",
60 61
    "//third_party/dart/runtime/bin:elf_loader",
    "//third_party/skia",
62 63
  ]
}
64

65 66 67 68
source_set("skia") {
  testonly = true

  sources = [
69 70 71 72 73
    "assertions_skia.cc",
    "assertions_skia.h",
    "canvas_test.h",
    "mock_canvas.cc",
    "mock_canvas.h",
74 75
    "mock_raster_cache.cc",
    "mock_raster_cache.h",
76 77 78 79
  ]

  public_deps = [
    ":testing_lib",
80
    "//flutter/flow",
81 82 83 84
    "//third_party/skia",
  ]
}

85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
if (enable_unittests) {
  # SwiftShader only supports x86/x64_64
  if (target_cpu == "x86" || target_cpu == "x64") {
    source_set("opengl") {
      testonly = true

      configs += [ "//third_party/swiftshader_flutter:swiftshader_config" ]

      sources = [
        "test_gl_surface.cc",
        "test_gl_surface.h",
      ]

      deps = [
        ":skia",
        "//flutter/fml",
        "//third_party/swiftshader_flutter:swiftshader_gl",
      ]
    }

    source_set("vulkan") {
      testonly = true
107

108 109 110 111 112 113 114
      configs += [ "//third_party/swiftshader_flutter:swiftshader_config" ]

      deps = [
        ":skia",
        "//flutter/fml",
        "//third_party/swiftshader_flutter:swiftshader_vulkan",
      ]
115 116
    }

117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
    # All targets on all platforms should be able to use the Metal utilities. On
    # platforms where Metal is not available, the tests must be skipped or
    # implemented to use another available client rendering API. This is usually
    # either OpenGL which is portably implemented via SwiftShader or the software
    # backend. This way, all tests compile on all platforms but the Metal backend
    # is exercised on platforms where Metal itself is available.
    source_set("metal") {
      testonly = true

      sources = [
        "test_metal_surface.cc",
        "test_metal_surface.h",
      ]

      defines = []

      if (shell_enable_metal) {
        sources += [ "test_metal_surface_impl.mm" ]
        defines += [ "TESTING_ENABLE_METAL" ]
      }

      deps = [
        ":skia",
        "//flutter/fml",
      ]
    }
143

144 145 146
    test_fixtures("testing_fixtures") {
      fixtures = []
    }
147

148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
    # The //flutter/testing library provides utility methods to other test targets.
    # This test target tests the testing utilities.
    executable("testing_unittests") {
      testonly = true

      sources = [
        "mock_canvas_unittests.cc",
        "test_metal_surface_unittests.cc",
      ]

      deps = [
        ":dart",
        ":metal",
        ":opengl",
        ":skia",
        ":testing",
        ":testing_fixtures",
        ":testing_lib",
      ]
    }
C
PR  
Chinmay Garde 已提交
168
  }
169
}