• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "connect_cancel_test.h"
20 
21 
test()22 void connect_cancel_test::test()
23 {
24     fprintf(fileoutput, "Start connect cancel test, proxy %d.\n", iUseProxy);
25     int error = 0;
26 
27     scheduler = OsclExecScheduler::Current();
28 
29     this->AddToScheduler();
30 
31     if (start_async_test())
32     {
33         OSCL_TRY(error, scheduler->StartScheduler());
34         if (error != 0)
35         {
36             OSCL_LEAVE(error);
37         }
38     }
39 
40     this->RemoveFromScheduler();
41 }
42 
43 
Run()44 void connect_cancel_test::Run()
45 {
46     if (terminal)
47     {
48         if (iUseProxy)
49         {
50             CPV2WayProxyFactory::DeleteTerminal(terminal);
51         }
52         else
53         {
54             CPV2WayEngineFactory::DeleteTerminal(terminal);
55         }
56         terminal = NULL;
57     }
58 
59     scheduler->StopScheduler();
60 }
61 
DoCancel()62 void connect_cancel_test::DoCancel()
63 {
64 }
65 
66 
HandleInformationalEvent(const PVAsyncInformationalEvent & aEvent)67 void connect_cancel_test::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent)
68 {
69 
70     switch (aEvent.GetEventType())
71     {
72         case PVT_INDICATION_DISCONNECT:
73             iAudioSourceAdded = false;
74             iVideoSourceAdded = false;
75             iAudioSinkAdded = false;
76             iVideoSinkAdded = false;
77             break;
78 
79         case PVT_INDICATION_INTERNAL_ERROR:
80             break;
81 
82         default:
83             break;
84     }
85 }
InitSucceeded()86 void connect_cancel_test::InitSucceeded()
87 {
88     int error;
89     test_base::InitSucceeded();
90     OSCL_TRY(error, iCancelCmdId = terminal->CancelAllCommands());
91     if (error)
92     {
93         test_is_true(false);
94         reset();
95     }
96 }
97 
InitFailed()98 void connect_cancel_test::InitFailed()
99 {
100 }
101 
ConnectCancelled()102 void connect_cancel_test::ConnectCancelled()
103 {
104 }
DisCmdSucceeded()105 void connect_cancel_test::DisCmdSucceeded()
106 {
107     test_is_true(true);
108     reset();
109 }
110 
DisCmdFailed()111 void connect_cancel_test::DisCmdFailed()
112 {
113     test_is_true(true);
114     reset();
115 }
CancelCmdCompleted()116 void connect_cancel_test::CancelCmdCompleted()
117 {
118     test_is_true(true);
119     reset();
120 }
121 
122 
123 
124 
125