-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add H5vccSystem web interface, set it as window.h5vcc.system (#4763)
The readonly property advertisingId return a dummy value. // command to compile all web tests cobalt/build/gn.py -p linux-x64x11 -C devel && \ autoninja -C out/linux-x64x11_devel blink_wpt_tests && \ autoninja -C out/linux-x64x11_devel dump_syms && \ autoninja -C out/linux-x64x11_devel minidump_stackwalk // command to run the test third_party/blink/tools/run_web_tests.py -t linux-x64x11_devel external/wpt/cobalt/h5vcc-system b/377049113
- Loading branch information
Showing
14 changed files
with
164 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
third_party/blink/renderer/modules/cobalt/h5vcc_system/BUILD.gn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2025 The Cobalt Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import("//third_party/blink/renderer/modules/modules.gni") | ||
|
||
blink_modules_sources("h5vcc_system") { | ||
sources = [ | ||
"h_5_vcc_system.cc", | ||
"h_5_vcc_system.h", | ||
] | ||
} |
36 changes: 36 additions & 0 deletions
36
third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2025 The Cobalt Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.h" | ||
|
||
#include "third_party/blink/renderer/core/frame/local_dom_window.h" | ||
|
||
namespace blink { | ||
|
||
H5vccSystem::H5vccSystem(LocalDOMWindow& window) {} | ||
|
||
const String H5vccSystem::advertisingId() const { | ||
NOTIMPLEMENTED(); | ||
|
||
// TODO(b/377049113) add a mojom service and populate the value for | ||
// advertising_id_. | ||
// return advertising_id_; | ||
return String("fake advertisingId"); | ||
} | ||
|
||
void H5vccSystem::Trace(Visitor* visitor) const { | ||
ScriptWrappable::Trace(visitor); | ||
} | ||
|
||
} // namespace blink |
41 changes: 41 additions & 0 deletions
41
third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2025 The Cobalt Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_H5VCC_SYSTEM_H_5_VCC_SYSTEM_H_ | ||
#define THIRD_PARTY_BLINK_RENDERER_MODULES_H5VCC_SYSTEM_H_5_VCC_SYSTEM_H_ | ||
|
||
#include "third_party/blink/renderer/modules/modules_export.h" | ||
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h" | ||
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" | ||
|
||
namespace blink { | ||
|
||
class LocalDOMWindow; | ||
class ScriptState; | ||
|
||
class MODULES_EXPORT H5vccSystem final : public ScriptWrappable { | ||
DEFINE_WRAPPERTYPEINFO(); | ||
|
||
public: | ||
explicit H5vccSystem(LocalDOMWindow&); | ||
|
||
// Web-exposed interface: | ||
const String advertisingId() const; | ||
|
||
void Trace(Visitor*) const override; | ||
}; | ||
|
||
} // namespace blink | ||
|
||
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_H5VCC_SYSTEM_H_5_VCC_SYSTEM_H_ |
23 changes: 23 additions & 0 deletions
23
third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.idl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2025 The Cobalt Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// This interface mirrors the H5vccSystem Web IDL defined in Cobalt LTS 25: | ||
// https://github.com/youtube/cobalt/blob/25.lts.stable/cobalt/h5vcc/h5vcc_system.idl | ||
[ | ||
Exposed=Window, | ||
SecureContext | ||
] | ||
interface H5vccSystem { | ||
readonly attribute DOMString advertisingId; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
third_party/blink/web_tests/external/wpt/cobalt/h5vcc-system/h5vcc-system.https.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>Test H5vccSystem web API.</title> | ||
<script src='/resources/testharness.js'></script> | ||
<script src='/resources/testharnessreport.js'></script> | ||
</head> | ||
<body> | ||
<script> | ||
test(() => { | ||
assert_equals(window.h5vcc.system.advertisingId, "fake advertisingId"); | ||
}, "H5vccSystem has the right property value"); | ||
</script> | ||
</body> | ||
</html> |