 Chromium Code Reviews
 Chromium Code Reviews Issue 2858353002:
  MediaPerceptionPrivate API impl and testing.  (Closed)
    
  
    Issue 2858353002:
  MediaPerceptionPrivate API impl and testing.  (Closed) 
  | Index: chrome/test/data/extensions/api_test/media_perception_private/state/runtest.js | 
| diff --git a/chrome/test/data/extensions/api_test/media_perception_private/state/runtest.js b/chrome/test/data/extensions/api_test/media_perception_private/state/runtest.js | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..138fd98e5f6909a44e0e8eadcfe659f88e57a014 | 
| --- /dev/null | 
| +++ b/chrome/test/data/extensions/api_test/media_perception_private/state/runtest.js | 
| @@ -0,0 +1,29 @@ | 
| +// Copyright 2017 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. | 
| + | 
| +let kStatusEnum = 'RUNNING' | 
| +let state = { status: kStatusEnum } | 
| + | 
| +function setState() { | 
| + chrome.mediaPerceptionPrivate.setState( | 
| + state, chrome.test.callback(stateCallback)); | 
| +} | 
| + | 
| +function getState() { | 
| + chrome.mediaPerceptionPrivate.getState( | 
| + chrome.test.callback(stateCallback)); | 
| +} | 
| + | 
| +function setStateUnsettable() { | 
| + state.status = 'UNINITIALIZED' | 
| + const error = 'Settable statuses are RUNNING and SUSPENDED.' | 
| + chrome.mediaPerceptionPrivate.setState(state, fail(error)); | 
| +} | 
| + | 
| +function stateCallback(response) { | 
| + chrome.test.assertEq(response.status, kStatusEnum); | 
| 
tbarzic
2017/05/09 01:28:36
I don't think it's worth having this as a separate
 
Luke Sorenson
2017/05/09 21:05:44
Done. Fine with getting rid of the callback method
 
tbarzic
2017/05/09 21:19:14
yes, but a couple should be OK to inline
 
Luke Sorenson
2017/05/10 18:50:16
I've got more than a couple now :)
 
tbarzic
2017/05/11 00:38:26
still, not too many - I find the inlined version e
 
Luke Sorenson
2017/05/11 23:57:58
Acknowledged.
 | 
| +} | 
| + | 
| +chrome.test.runTests([setState, getState]); | 
| + |