stop-without-preceeding-start.js 882 Bytes
Newer Older
1 2 3 4
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
let {session, contextGroup, Protocol} = InspectorTest.start("Test that profiler doesn't crash when we call stop without preceding start.");
6

7
Protocol.Profiler.stop().then(didStopProfile);
8 9
function didStopProfile(messageObject)
{
10
  expectedError("ProfileAgent.stop", messageObject);
11 12
  InspectorTest.completeTest();
}
13 14 15 16 17 18 19 20 21 22 23 24 25 26

function checkExpectation(fail, name, messageObject)
{
  if (fail === !!messageObject.error) {
    InspectorTest.log("PASS: " + name);
    return true;
  }

  InspectorTest.log("FAIL: " + name + ": " + JSON.stringify(messageObject));
  InspectorTest.completeTest();
  return false;
}
var expectedSuccess = checkExpectation.bind(null, false);
var expectedError = checkExpectation.bind(null, true);