• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { paramMock } from "../utils"
17
18export function mockUri() {
19  const result = {
20    URI: function (...args) {
21      console.warn("uri.URI interface mocked in the Previewer. How this interface works on the Previewer" +
22        " may be different from that on a real device.")
23      return URIMock;
24    }
25  }
26  const URIMock = {
27    toString: function (...args) {
28      console.warn("URI.toString interface mocked in the Previewer. How this interface works on the Previewer" +
29        " may be different from that on a real device.")
30      return paramMock.paramStringMock;
31    },
32    equals: function (...args) {
33      console.warn("URI.equals interface mocked in the Previewer. How this interface works on the Previewer" +
34        " may be different from that on a real device.")
35      return paramMock.paramBooleanMock;
36    },
37    checkIsAbsolute: function (...args) {
38      console.warn("URI.checkIsAbsolute interface mocked in the Previewer. How this interface works on the Previewer" +
39        " may be different from that on a real device.")
40      return paramMock.paramBooleanMock;
41    },
42    normalize: function (...args) {
43      console.warn("URI.normalize interface mocked in the Previewer. How this interface works on the Previewer" +
44        " may be different from that on a real device.")
45      return paramMock.paramObjectMock;
46    },
47    scheme: '[PC preview] unknow scheme',
48    userinfo: '[PC preview] unknow userinfo',
49    host: '[PC preview] unknow host',
50    port: '[PC preview] unknow port',
51    path: '[PC preview] unknow path',
52    query: '[PC preview] unknow query',
53    fragment: '[PC preview] unknow fragment',
54    authority: '[PC preview] unknow authority',
55    ssp: '[PC preview] unknow ssp'
56  }
57  return result;
58}
59