mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Some additional error checking for observer service. Direct rv results to screen dialog for nsIEditingSession tests. Not part of the build.
This commit is contained in:
parent
8083341091
commit
9166a49fd9
@ -81,45 +81,51 @@ nsIEditingSession * CnsIEditSession::GetEditSessionObject()
|
||||
return (editingSession);
|
||||
}
|
||||
|
||||
void CnsIEditSession::InitTest()
|
||||
void CnsIEditSession::InitTest(PRInt16 displayMode)
|
||||
{
|
||||
editingSession = GetEditSessionObject();
|
||||
domWindow = GetTheDOMWindow(qaWebBrowser);
|
||||
if (domWindow && editingSession) {
|
||||
rv = editingSession->Init(domWindow);
|
||||
RvTestResult(rv, "Init() test", 2);
|
||||
RvTestResult(rv, "Init() test", displayMode);
|
||||
if (displayMode == 1)
|
||||
RvTestResultDlg(rv, "Init() test", true);
|
||||
}
|
||||
else
|
||||
QAOutput("Didn't get object(s) for InitTest() test. Test failed.", 1);
|
||||
}
|
||||
|
||||
void CnsIEditSession::MakeWinEditTest(PRBool afterUriLoad)
|
||||
void CnsIEditSession::MakeWinEditTest(PRBool afterUriLoad, PRInt16 displayMode)
|
||||
{
|
||||
editingSession = GetEditSessionObject();
|
||||
domWindow = GetTheDOMWindow(qaWebBrowser);
|
||||
if (domWindow && editingSession) {
|
||||
// aEditorType (2nd param) is crashing with null entry. bug 174151
|
||||
rv= editingSession->MakeWindowEditable(domWindow, "text", afterUriLoad);
|
||||
RvTestResult(rv, "MakeWindowEditable() test", 2);
|
||||
RvTestResult(rv, "MakeWindowEditable() test", displayMode);
|
||||
if (displayMode == 1)
|
||||
RvTestResultDlg(rv, "MakeWindowEditable() test");
|
||||
}
|
||||
else
|
||||
QAOutput("Didn't get object(s) for MakeWindowEditable() test. Test failed.", 1);
|
||||
}
|
||||
|
||||
void CnsIEditSession::WinIsEditTest(PRBool outIsEditable)
|
||||
void CnsIEditSession::WinIsEditTest(PRBool outIsEditable, PRInt16 displayMode)
|
||||
{
|
||||
editingSession = GetEditSessionObject();
|
||||
domWindow = GetTheDOMWindow(qaWebBrowser);
|
||||
if (domWindow && editingSession) {
|
||||
rv = editingSession->WindowIsEditable(domWindow, &outIsEditable);
|
||||
RvTestResult(rv, "WindowIsEditable() test", 2);
|
||||
FormatAndPrintOutput("the outIsEditable boolean = ", outIsEditable, 2);
|
||||
RvTestResult(rv, "WindowIsEditable() test", displayMode);
|
||||
if (displayMode == 1)
|
||||
RvTestResultDlg(rv, "WindowIsEditable() test");
|
||||
FormatAndPrintOutput("the outIsEditable boolean = ", outIsEditable, displayMode);
|
||||
}
|
||||
else
|
||||
QAOutput("Didn't get object(s) for WinIsEditTest() test. Test failed.", 1);
|
||||
}
|
||||
|
||||
void CnsIEditSession::GetEditorWinTest()
|
||||
void CnsIEditSession::GetEditorWinTest(PRInt16 displayMode)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> theEditor;
|
||||
// nsIEditor *theEditor = nsnull;
|
||||
@ -127,7 +133,9 @@ void CnsIEditSession::GetEditorWinTest()
|
||||
domWindow = GetTheDOMWindow(qaWebBrowser);
|
||||
if (domWindow && editingSession) {
|
||||
rv = editingSession->GetEditorForWindow(domWindow, getter_AddRefs(theEditor));
|
||||
RvTestResult(rv, "GetEditorForWindow() test", 2);
|
||||
RvTestResult(rv, "GetEditorForWindow() test", displayMode);
|
||||
if (displayMode == 1)
|
||||
RvTestResultDlg(rv, "GetEditorForWindow() test");
|
||||
if (!theEditor)
|
||||
QAOutput("Didn't get the Editor object.");
|
||||
}
|
||||
@ -135,25 +143,29 @@ void CnsIEditSession::GetEditorWinTest()
|
||||
QAOutput("Didn't get object(s) for WinIsEditTest() test. Test failed.", 1);
|
||||
}
|
||||
|
||||
void CnsIEditSession::SetEditorWinTest()
|
||||
void CnsIEditSession::SetEditorWinTest(PRInt16 displayMode)
|
||||
{
|
||||
editingSession = GetEditSessionObject();
|
||||
domWindow = GetTheDOMWindow(qaWebBrowser);
|
||||
if (domWindow && editingSession) {
|
||||
rv = editingSession->SetupEditorOnWindow(domWindow);
|
||||
RvTestResult(rv, "SetupEditorOnWindow() test", 2);
|
||||
RvTestResult(rv, "SetupEditorOnWindow() test", displayMode);
|
||||
if (displayMode == 1)
|
||||
RvTestResultDlg(rv, "SetupEditorOnWindow() test");
|
||||
}
|
||||
else
|
||||
QAOutput("Didn't get object(s) for SetEditorWinTest() test. Test failed.", 1);
|
||||
}
|
||||
|
||||
void CnsIEditSession::TearEditorWinTest()
|
||||
void CnsIEditSession::TearEditorWinTest(PRInt16 displayMode)
|
||||
{
|
||||
editingSession = GetEditSessionObject();
|
||||
domWindow = GetTheDOMWindow(qaWebBrowser);
|
||||
if (domWindow && editingSession) {
|
||||
rv = editingSession->TearDownEditorOnWindow(domWindow);
|
||||
RvTestResult(rv, "TearDownEditorOnWindow() test", 2);
|
||||
RvTestResult(rv, "TearDownEditorOnWindow() test", displayMode);
|
||||
if (displayMode == 1)
|
||||
RvTestResultDlg(rv, "TearDownEditorOnWindow() test");
|
||||
}
|
||||
else
|
||||
QAOutput("Didn't get object(s) for TearEditorWinTest() test. Test failed.", 1);
|
||||
@ -167,34 +179,34 @@ void CnsIEditSession::OnStartTests(UINT nMenuID)
|
||||
RunAllTests();
|
||||
break;
|
||||
case ID_INTERFACES_NSIEDITINGSESSION_INIT :
|
||||
InitTest();
|
||||
InitTest(2);
|
||||
break;
|
||||
case ID_INTERFACES_NSIEDITINGSESSION_MAKEWINDOWEDITABLE :
|
||||
MakeWinEditTest(PR_FALSE);
|
||||
MakeWinEditTest(PR_FALSE, 2);
|
||||
break;
|
||||
case ID_INTERFACES_NSIEDITINGSESSION_WINDOWISEDITABLE :
|
||||
WinIsEditTest(PR_TRUE);
|
||||
WinIsEditTest(PR_TRUE, 2);
|
||||
break;
|
||||
case ID_INTERFACES_NSIEDITINGSESSION_GETEDITORFORWINDOW :
|
||||
GetEditorWinTest();
|
||||
GetEditorWinTest(2);
|
||||
break;
|
||||
case ID_INTERFACES_NSIEDITINGSESSION_SETUPEDITORONWINDOW :
|
||||
SetEditorWinTest();
|
||||
SetEditorWinTest(2);
|
||||
break;
|
||||
case ID_INTERFACES_NSIEDITINGSESSION_TEARDOWNEDITORONWINDOW :
|
||||
TearEditorWinTest();
|
||||
TearEditorWinTest(2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CnsIEditSession::RunAllTests()
|
||||
{
|
||||
InitTest();
|
||||
MakeWinEditTest(PR_FALSE);
|
||||
WinIsEditTest(PR_TRUE);
|
||||
GetEditorWinTest();
|
||||
// SetEditorWinTest();
|
||||
TearEditorWinTest();
|
||||
InitTest(1);
|
||||
MakeWinEditTest(PR_FALSE, 1);
|
||||
WinIsEditTest(PR_TRUE, 1);
|
||||
GetEditorWinTest(1);
|
||||
// SetEditorWinTest(1);
|
||||
TearEditorWinTest(1);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -83,12 +83,12 @@ public:
|
||||
|
||||
// local methods for nsIEditingSession tests
|
||||
nsIEditingSession * GetEditSessionObject();
|
||||
void InitTest(void);
|
||||
void MakeWinEditTest(PRBool);
|
||||
void WinIsEditTest(PRBool);
|
||||
void SetEditorWinTest(void);
|
||||
void GetEditorWinTest(void);
|
||||
void TearEditorWinTest(void);
|
||||
void InitTest(PRInt16);
|
||||
void MakeWinEditTest(PRBool, PRInt16);
|
||||
void WinIsEditTest(PRBool, PRInt16);
|
||||
void SetEditorWinTest(PRInt16);
|
||||
void GetEditorWinTest(PRInt16);
|
||||
void TearEditorWinTest(PRInt16);
|
||||
void OnStartTests(UINT nMenuID);
|
||||
void RunAllTests(void);
|
||||
|
||||
|
@ -177,6 +177,12 @@ void CnsIObserServ::NotifyObserversTest(int displayType)
|
||||
|
||||
QAOutput("\n nsIObserverService::NotifyObserversTest().");
|
||||
|
||||
if (!observerService)
|
||||
{
|
||||
QAOutput("Can't get nsIObserverService object. Tests fail.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i=0; i<10; i++)
|
||||
{
|
||||
FormatAndPrintOutput("The notified observer = ", ObserverTable[i].theTopic, 1);
|
||||
@ -223,6 +229,11 @@ void CnsIObserServ::EnumerateObserversTest(int displayType)
|
||||
{
|
||||
simpleEnum->GetNext(getter_AddRefs(observer));
|
||||
|
||||
if (!observer)
|
||||
{
|
||||
QAOutput("Didn't get the observer object. Tests fail.");
|
||||
return;
|
||||
}
|
||||
rv = observer->Observe(observer, ObserverTable[i].theTopic, 0);
|
||||
RvTestResult(rv, "nsIObserver() test", 1);
|
||||
RvTestResultDlg(rv, "nsIObserver() test");
|
||||
|
Loading…
Reference in New Issue
Block a user