Revision b55e29597d92ab89063673f031151e2bdb4b9479 authored by Joe Downing on 22 March 2018, 07:35:35 UTC, committed by Chromium WPT Sync on 22 March 2018, 07:35:35 UTC
This change moves the KeyboardLock API methods to a 'keyboard'
namespace on the Navigator object.  We are doing this work now as
there has been a request for additional keyboard functionality that
would also be placed on the new keyboard object and we wanted to
move the KeyboardLock methods there for consistency before we launch.

KeyboardLock API Spec is here:
https://w3c.github.io/keyboard-lock/#API

Old calling pattern:
Navigator.keyboardLock();
Navigator.keyboardUnlock();

New calling pattern:
Navigator.keyboard.lock();
Navigator.keyboard.unlock();

Note: The main logic in the KeyboardLock.cpp class and tests is the
same as it was, however the file changed enough that git does not
recognize it as a file move.

BUG=680809

Change-Id: I234b2ab12d5ecd44c894ed5103863fd96fd548d4
Reviewed-on: https://chromium-review.googlesource.com/969656
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Reviewed-by: Gary Kacmarcik <garykac@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544996}
1 parent 1a8c195
Raw File
generate_test.py
#!/usr/bin/python

# 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.
#
# TODO(50903): Delete the file in LayoutTests/bluetooth after all the tests have
# been migrated to this directory.
"""Test that the set of gen-* files is the same as the generated files."""

import fnmatch
import os
import sys
import generate
import logging

UPDATE_TIP = 'To update the generated tests, run:\n' \
             '$ python third_party/WebKit/LayoutTests/bluetooth/generate.py'


def main():
  logging.basicConfig(level=logging.INFO)
  logging.info(UPDATE_TIP)
  generated_files = set()
  # Tests data in gen-* files is the same as the data generated.
  for generated_test in generate.GetGeneratedTests():
    generated_files.add(generated_test.path)
    try:
      with open(generated_test.path, 'r') as f:
        data = f.read().decode('utf-8')
        if data != generated_test.data:
          logging.error('%s does not match template', generated_test.path)
          return -1
    except IOError, e:
      if e.errno == 2:
        logging.error('Missing generated test:\n%s\nFor template:\n%s',
                     generated_test.path,
                     generated_test.template)
        return -1

  # Tests that there are no obsolete generated files.
  previous_generated_files = set()
  current_path = os.path.dirname(os.path.realpath(__file__))
  for root, _, filenames in os.walk(current_path):
    for filename in fnmatch.filter(filenames, 'gen-*.https.html'):
      previous_generated_files.add(os.path.join(root, filename))

  if previous_generated_files != generated_files:
    logging.error('There are extra generated tests. Please remove them.')
    for test_path in previous_generated_files - generated_files:
      logging.error('%s', test_path)
    return -1


if __name__ == '__main__':
  sys.exit(main())
back to top