Revision 273bb41376c98c36e743186b63ec3cffa58a5339 authored by Ovidio Henriquez on 23 March 2018, 15:12:10 UTC, committed by Blink WPT Bot on 23 March 2018, 15:30:21 UTC
This change allows the removal of a descriptor to be simulated by the
Bluetooth test interface. A generated test script was also converted to test the
new interface.

BUG=569709

Change-Id: Id4286a3e44cd04ee1b371938f1ef89f33458269c
Reviewed-on: https://chromium-review.googlesource.com/972334
Reviewed-by: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Conley Owens <cco3@chromium.org>
Commit-Queue: Ovidio Henriquez <odejesush@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545448}
1 parent 2d1fd9e
Raw File
po-observe.any.js
// META: script=performanceobservers.js

  test(function () {
    var obs = new PerformanceObserver(function () { return true; });
    assert_throws(new TypeError(), function () {
      obs.observe({});
    });
    assert_throws(new TypeError(), function () {
      obs.observe({entryType: []});
    });
  }, "no entryTypes throws a TypeError");
  test(function () {
    var obs = new PerformanceObserver(function () { return true; });
    assert_throws(new TypeError(), function () {
      obs.observe({entryTypes: "mark"});
    });
  }, "entryTypes must be a sequence or throw a TypeError");

  test(function () {
    var obs = new PerformanceObserver(function () { return true; });
    obs.observe({entryTypes: []});
  }, "Empty sequence entryTypes is a no-op");

  test(function () {
    var obs = new PerformanceObserver(function () { return true; });
    obs.observe({entryTypes: ["this-cannot-match-an-entryType"]});
    obs.observe({entryTypes: ["marks","navigate", "resources"]});
  }, "Unknown entryTypes are no-op");

  test(function () {
    var obs = new PerformanceObserver(function () { return true; });
    obs.observe({entryTypes: ["mark","this-cannot-match-an-entryType"]});
    obs.observe({entryTypes: ["this-cannot-match-an-entryType","mark"]});
    obs.observe({entryTypes: ["mark"], others: true});
  }, "Filter unsupported entryType entryType names within the entryTypes sequence");

  async_test(function (t) {
    var finish = t.step_func(function () { t.done(); });
    var observer = new PerformanceObserver(
      function (entryList, obs) {
        var self = this;
        t.step(function () {
          assert_true(entryList instanceof PerformanceObserverEntryList, "first callback parameter must be a PerformanceObserverEntryList instance");
          assert_true(obs instanceof PerformanceObserver, "second callback parameter must be a PerformanceObserver instance");
          assert_equals(observer, self, "observer is the this value");
          assert_equals(observer, obs, "observer is second parameter");
          assert_equals(self, obs, "this and second parameter are the same");
          observer.disconnect();
          finish();
        });
      }
    );
    self.performance.clearMarks();
    observer.observe({entryTypes: ["mark"]});
    self.performance.mark("mark1");
  }, "Check observer callback parameter and this values");

  async_test(function (t) {
  var observer = new PerformanceObserver(
      t.step_func(function (entryList, obs) {
        checkEntries(entryList.getEntries(),
          [{ entryType: "measure", name: "measure1"}]);
        observer.disconnect();
        t.done();
      })
    );
    self.performance.clearMarks();
    observer.observe({entryTypes: ["mark"]});
    observer.observe({entryTypes: ["measure"]});
    self.performance.mark("mark1");
    self.performance.measure("measure1");
  }, "replace observer if already present");
back to top