1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 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 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 19 #include "init_cancel_test.h" 20 test()21void init_cancel_test::test() 22 { 23 fprintf(fileoutput, "Start init cancel test, proxy %d.\n", iUseProxy); 24 int error = 0; 25 26 scheduler = OsclExecScheduler::Current(); 27 28 this->AddToScheduler(); 29 30 if (start_async_test()) 31 { 32 OSCL_TRY(error, scheduler->StartScheduler()); 33 if (error != 0) 34 { 35 OSCL_LEAVE(error); 36 } 37 } 38 39 this->RemoveFromScheduler(); 40 } 41 42 Run()43void init_cancel_test::Run() 44 { 45 if (terminal) 46 { 47 if (iUseProxy) 48 { 49 CPV2WayProxyFactory::DeleteTerminal(terminal); 50 } 51 else 52 { 53 CPV2WayEngineFactory::DeleteTerminal(terminal); 54 } 55 terminal = NULL; 56 } 57 58 scheduler->StopScheduler(); 59 } 60 DoCancel()61void init_cancel_test::DoCancel() 62 { 63 } 64 65 HandleInformationalEvent(const PVAsyncInformationalEvent & aEvent)66void init_cancel_test::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 67 { 68 OSCL_UNUSED_ARG(aEvent); 69 } 70 InitSucceeded()71void init_cancel_test::InitSucceeded() 72 { 73 test_is_true(true); 74 reset(); 75 } 76 InitCancelled()77void init_cancel_test::InitCancelled() 78 { 79 InitSucceeded(); 80 } 81 InitFailed()82void init_cancel_test::InitFailed() 83 { 84 test_is_true(false); 85 RunIfNotReady(); 86 } 87 88 QueryInterfaceSucceeded()89void init_cancel_test::QueryInterfaceSucceeded() 90 { 91 test_base::QueryInterfaceSucceeded(); 92 93 int error = 0; 94 OSCL_TRY(error, iCnclCmdId = terminal->CancelAllCommands()); 95 if (error) 96 { 97 test_is_true(false); 98 } 99 100 } 101 102 103