summaryrefslogtreecommitdiff
path: root/tests/auto/widgets/proxypac/CMakeLists.txt
blob: f27160cb691dcff8a43d362f64ec57b779c9707b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause

include(../../httpserver/httpserver.cmake)

qt_internal_add_test(tst_proxypac_file
    SOURCES
        tst_proxypac.cpp
    LIBRARIES
        Qt::WebEngineCore
        Test::HttpServer
)

if(WIN32)
    get_filename_component(SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
    set(fileEnvArg "--proxy-pac-url=\"file:///${SOURCE_DIR}/proxy.pac\"")
elseif(LINUX AND CMAKE_CROSSCOMPILING)
    set(fileEnvArg "--single-process --no-sandbox --proxy-pac-url=\"file://${CMAKE_CURRENT_LIST_DIR}/proxy.pac\"")
else()
    set(fileEnvArg "--proxy-pac-url=\"file://${CMAKE_CURRENT_LIST_DIR}/proxy.pac\"")
endif()

set_tests_properties(tst_proxypac_file PROPERTIES
    ENVIRONMENT QTWEBENGINE_CHROMIUM_FLAGS=${fileEnvArg}
)

if(NOT (LINUX AND CMAKE_CROSSCOMPILING))
    set(fileEnvArg "--single-process ${fileEnvArg}")

    qt_internal_add_test(tst_proxypac_single_process
        SOURCES
            tst_proxypac.cpp
        LIBRARIES
            Qt::WebEngineCore
            Test::HttpServer
    )

    set_tests_properties(tst_proxypac_single_process PROPERTIES
        ENVIRONMENT QTWEBENGINE_CHROMIUM_FLAGS=${fileEnvArg}
    )
endif()

qt_internal_add_test(tst_proxypac_qrc
    SOURCES
        tst_proxypac.cpp
    LIBRARIES
        Qt::WebEngineCore
        Test::HttpServer
)

if(LINUX AND CMAKE_CROSSCOMPILING)
    set(qrcEnvArg "--single-process --no-sandbox --proxy-pac-url=\"qrc:///proxy.pac\"")
else()
    set(qrcEnvArg "--proxy-pac-url=\"qrc:///proxy.pac\"")
endif()

set_tests_properties(tst_proxypac_qrc PROPERTIES
    ENVIRONMENT QTWEBENGINE_CHROMIUM_FLAGS=${qrcEnvArg}
)

qt_internal_add_resource(tst_proxypac_qrc "proxypac"
    PREFIX "/"
    FILES "proxy.pac"
)