Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / api_test / hotword_private / hotwordSession / test.js
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 chrome.test.runTests([
6   function hotwordSessionTest() {
7     chrome.hotwordPrivate.onHotwordSessionRequested.addListener(function () {
8       chrome.hotwordPrivate.setHotwordSessionState(true, function() {
9         chrome.hotwordPrivate.notifyHotwordRecognition('search', function() {
10           chrome.hotwordPrivate.onHotwordSessionStopped.addListener(
11               function() {
12                 // Calling setHotwordSessionState and
13                 // notifyHotwordRecognition after stopped should be ignored.
14                 chrome.hotwordPrivate.setHotwordSessionState(false, function() {
15                   chrome.hotwordPrivate.notifyHotwordRecognition(
16                       'search', function() {
17                         chrome.test.sendMessage("stopped");
18                         chrome.test.succeed();
19                       });
20                 });
21               });
22           chrome.test.sendMessage("stopReady");
23         });
24       });
25     });
26     chrome.test.sendMessage("ready");
27   }
28 ]);