1/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package com.android.tv.tests.ui;
17
18import static com.android.tv.testing.uihelper.UiDeviceAsserts.assertHas;
19import static com.android.tv.testing.uihelper.UiDeviceAsserts.assertWaitForCondition;
20
21import android.support.test.uiautomator.Until;
22import android.test.suitebuilder.annotation.LargeTest;
23
24import com.android.tv.R;
25import com.android.tv.testing.uihelper.Constants;
26
27/**
28 * Test timeout events like the menu despairing after no input.
29 * <p>
30 * <b>WARNING</b> some of these timeouts are 60 seconds. These tests will take a long time
31 * complete.
32 */
33@LargeTest
34public class TimeoutTest extends LiveChannelsTestCase {
35
36    public void testMenu() {
37        mLiveChannelsHelper.assertAppStarted();
38        mDevice.pressMenu();
39
40        assertWaitForCondition(mDevice, Until.hasObject(Constants.MENU));
41        assertWaitForCondition(mDevice, Until.gone(Constants.MENU),
42                mTargetResources.getInteger(R.integer.menu_show_duration));
43    }
44
45    public void testProgramGuide() {
46        mLiveChannelsHelper.assertAppStarted();
47        mMenuHelper.assertPressProgramGuide();
48        assertWaitForCondition(mDevice,
49                Until.hasObject(Constants.PROGRAM_GUIDE));
50        assertWaitForCondition(mDevice, Until.gone(Constants.PROGRAM_GUIDE),
51                mTargetResources.getInteger(R.integer.program_guide_show_duration));
52        assertHas(mDevice, Constants.MENU, false);
53    }
54}
55