summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/testing/origin_trials_test.h
blob: 703e5a7c8cf5ccad24c3d44dc097cb17877177bb (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
65
66
67
68
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_TESTING_ORIGIN_TRIALS_TEST_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_TESTING_ORIGIN_TRIALS_TEST_H_

#include "third_party/blink/renderer/bindings/core/v8/idl_dictionary_base.h"
#include "third_party/blink/renderer/core/testing/origin_trials_test_dictionary.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/heap/handle.h"

namespace blink {

class ExceptionState;
class ScriptState;

// OriginTrialsTest is a very simple interface used for testing
// origin-trial-enabled features which are attached directly to interfaces at
// run-time.
class OriginTrialsTest : public ScriptWrappable {
  DEFINE_WRAPPERTYPEINFO();

 public:
  OriginTrialsTest() = default;
  ~OriginTrialsTest() override = default;

  bool normalAttribute() { return true; }
  static bool staticAttribute() { return true; }
  bool normalMethod() { return true; }
  static bool staticMethod() { return true; }
  static const uint16_t kConstant = 1;

  bool throwingAttribute(ScriptState*, ExceptionState&);
  OriginTrialsTestDictionary* getDictionaryMethod() {
    return OriginTrialsTestDictionary::Create();
  }
  void checkDictionaryMethod(const OriginTrialsTestDictionary*) {}

  bool unconditionalAttribute() { return true; }
  static bool staticUnconditionalAttribute() { return true; }
  bool unconditionalMethod() { return true; }
  void unconditionalDictionaryMethod(const OriginTrialsTestDictionary* dict) {}
  static bool staticUnconditionalMethod() { return true; }
  static const uint16_t kUnconditionalConstant = 99;

  bool secureUnconditionalAttribute() { return true; }
  static bool secureStaticUnconditionalAttribute() { return true; }
  bool secureUnconditionalMethod() { return true; }
  static bool secureStaticUnconditionalMethod() { return true; }

  bool secureAttribute() { return true; }
  static bool secureStaticAttribute() { return true; }
  bool secureMethod() { return true; }
  static bool secureStaticMethod() { return true; }

  bool deprecationAttribute() { return true; }

  bool impliedAttribute() { return true; }

  bool invalidOSAttribute() { return true; }

  bool navigationMethod() { return true; }
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_TESTING_ORIGIN_TRIALS_TEST_H_