3 Copyright (c) 2014 Samsung Electronics Co., Ltd.
5 Licensed under the Apache License, Version 2.0 (the License);
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
18 Hyukin Kwon <hyukin.kwon@samsung.com>
23 <title>HumanActivityMonitorOption_callbackInterval_type_GPS_default</title>
24 <meta charset="utf-8"/>
25 <script src="support/unitcommon.js"></script>
26 <script src="support/humanactivitymonitor_common.js"></script>
31 //==== TEST: HumanActivityMonitorOption_callbackInterval_type_GPS_default
32 //==== LABEL Check if method HumanActivityMonitorOption::callbackInterval works properly when set to null
34 //==== EXECUTION_TYPE manual
35 //==== SPEC Tizen Web API:System:HumanActivityMonitor:HumanActivityMonitorOption:callbackInterval A
37 //==== STEP Turn off the screen, then wait 150 seconds for the callback
38 //==== EXPECT Pass should be shown in the page after turn off the screen 150 seconds
40 //==== ONLOAD_DELAY 300
42 setup({"timeout": 400000});
44 var t = async_test(document.title, {"timeout": 400000}), onScreenStateChanged, changedCallback, startMeasure, endMeasure, humanActivityType = "GPS", cbFlag = 0;
47 add_result_callback(function () {
48 tizen.humanactivitymonitor.stop(humanActivityType);
51 changedCallback = t.step_func(function (gpsInfo) {
53 endMeasure = new Date().getTime();
54 assert_approx_equals(endMeasure - startMeasure, 150000, 1000, "Callback should be invoked in given interval time.");
58 startMeasure = new Date().getTime();
63 onScreenStateChanged = t.step_func(function (previousState, changedState) {
64 if (changedState === "SCREEN_OFF") {
65 tizen.humanactivitymonitor.start(humanActivityType, changedCallback, null, {callbackInterval:null});
66 startMeasure = new Date().getTime();
67 tizen.power.unsetScreenStateChangeListener();
71 alert('Please turn off the screen');
72 tizen.power.setScreenStateChangeListener(onScreenStateChanged);