+++ /dev/null
-/*\r
- * Common\r
- *\r
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact: \r
- * BonYong Lee <bonyong.lee@samsung.com>\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- *\r
- */\r
-package org.tizen.common.util;\r
-\r
-import static org.mockito.Mockito.mock;\r
-import static org.mockito.Mockito.times;\r
-import static org.mockito.Mockito.verify;\r
-import static org.mockito.Mockito.verifyNoMoreInteractions;\r
-import static org.tizen.common.util.ThreadUtil.trySleep;\r
-\r
-import org.junit.Test;\r
-\r
-/**\r
- * DefferedTaskManagerTest\r
- *\r
- * Test case for {@link DeferredTaskManager}\r
- * \r
- * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)\r
- * \r
- * @see DeferredTaskManager\r
- */\r
-public class\r
-DeferredTaskManagerTest\r
-{\r
-\r
- /**\r
- * Test {@link DeferredTaskManager#tick()}\r
- * \r
- * @throws Exception in case of failure in test\r
- * \r
- * @see DeferredTaskManager#tick()\r
- */\r
- @Test\r
- public\r
- void\r
- test_tick()\r
- {\r
- final Runnable run = mock( Runnable.class );\r
- final DeferredTaskManager target = new DeferredTaskManager( run );\r
- target.setIdleTime( 100 );\r
- target.tick();\r
- verifyNoMoreInteractions( run );\r
- \r
- trySleep( 100 );\r
- verify( run ).run();\r
- target.tick();\r
- trySleep( 50 );\r
- verifyNoMoreInteractions( run );\r
- target.setIdleTime( 50 );\r
- verify( run, times( 2 ) ).run();\r
- \r
- target.tick();\r
- verifyNoMoreInteractions( run );\r
- target.setIdleTime( 100 );\r
- verifyNoMoreInteractions( run );\r
- trySleep( 50 );\r
- verifyNoMoreInteractions( run );\r
- target.setIdleTime( 150 );\r
- verifyNoMoreInteractions( run );\r
- trySleep( 50 );\r
- verifyNoMoreInteractions( run );\r
- target.setIdleTime( 200 );\r
- verifyNoMoreInteractions( run );\r
- trySleep( 200 );\r
- verify( run, times( 3 ) ).run();\r
- \r
- }\r
- \r
-\r
-}\r