зеркало из https://github.com/mozilla/pjs.git
Added SaveObject() function in QAUtils.cpp. This is called in AsyncOpenTest() to compare the support objects passed to AsyncOpen and OnStartRequest.
This commit is contained in:
Родитель
66d76ca008
Коммит
4212c049c2
|
@ -101,6 +101,8 @@ CBrowserImpl::CBrowserImpl()
|
|||
CBrowserImpl::~CBrowserImpl()
|
||||
{
|
||||
}
|
||||
|
||||
extern storage getSupportObj;
|
||||
|
||||
// It's very important that the creator of this CBrowserImpl object
|
||||
// Call on this Init() method with proper values after creation
|
||||
|
@ -538,7 +540,12 @@ NS_IMETHODIMP CBrowserImpl::OnStartRequest(nsIRequest *request,
|
|||
QAOutput("##### BEGIN: nsIRequestObserver::OnStartRequest() #####");
|
||||
|
||||
if (!ctxt)
|
||||
QAOutput("We did NOT get the context object.\n");
|
||||
QAOutput("We did NOT get the context object.\n");
|
||||
|
||||
if (ctxt == getSupportObj.sup)
|
||||
QAOutput("Context objects equal each other.\n");
|
||||
else
|
||||
QAOutput("Context objects don't equal each other.\n");
|
||||
|
||||
RequestName(request, stringMsg, 1);
|
||||
|
||||
|
@ -629,7 +636,7 @@ NS_IMETHODIMP CBrowserImpl::OnStartURIOpen(nsIURI *aURI, PRBool *_retval)
|
|||
{
|
||||
QAOutput("nsIURIContentListener->OnStartURIOpen()",1);
|
||||
|
||||
GetTheUri(aURI, 1);
|
||||
GetTheURI(aURI, 1);
|
||||
// set return boolean to false so uriOpen doesn't abort
|
||||
*_retval = PR_FALSE;
|
||||
FormatAndPrintOutput("_retval set to = ", *_retval, 1);
|
||||
|
|
|
@ -67,43 +67,43 @@ class CBrowserView;
|
|||
// CBrowserImpl::nsISHistoryListener methods
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP CBrowserImpl::OnHistoryNewEntry(nsIURI *theUri)
|
||||
NS_IMETHODIMP CBrowserImpl::OnHistoryNewEntry(nsIURI *theURI)
|
||||
{
|
||||
QAOutput("nsIHistoryListener::OnHistoryNewEntry()", 2);
|
||||
GetTheUri(theUri, 1);
|
||||
GetTheURI(theURI, 1);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP CBrowserImpl::OnHistoryGoBack(nsIURI *theUri, PRBool *notify)
|
||||
NS_IMETHODIMP CBrowserImpl::OnHistoryGoBack(nsIURI *theURI, PRBool *notify)
|
||||
{
|
||||
QAOutput("nsIHistoryListener::OnHistoryGoBack()", 2);
|
||||
|
||||
GetTheUri(theUri, 1);
|
||||
GetTheURI(theURI, 1);
|
||||
*notify = PR_TRUE;
|
||||
FormatAndPrintOutput("OnHistoryGoBack() notification = ", *notify, 1);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserImpl::OnHistoryGoForward(nsIURI *theUri, PRBool *notify)
|
||||
NS_IMETHODIMP CBrowserImpl::OnHistoryGoForward(nsIURI *theURI, PRBool *notify)
|
||||
{
|
||||
QAOutput("nsIHistoryListener::OnHistoryGoForward()", 2);
|
||||
|
||||
GetTheUri(theUri, 1);
|
||||
GetTheURI(theURI, 1);
|
||||
*notify = PR_TRUE;
|
||||
FormatAndPrintOutput("OnHistoryGoForward() notification = ", *notify, 1);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserImpl::OnHistoryReload(nsIURI *theUri, PRUint32 reloadFlags, PRBool *notify)
|
||||
NS_IMETHODIMP CBrowserImpl::OnHistoryReload(nsIURI *theURI, PRUint32 reloadFlags, PRBool *notify)
|
||||
{
|
||||
char flagString[200];
|
||||
|
||||
QAOutput("nsIHistoryListener::OnHistoryReload()", 2);
|
||||
|
||||
GetTheUri(theUri, 1);
|
||||
GetTheURI(theURI, 1);
|
||||
*notify = PR_TRUE;
|
||||
FormatAndPrintOutput("OnHistoryReload() notification = ", *notify, 1);
|
||||
|
||||
|
@ -132,11 +132,11 @@ NS_IMETHODIMP CBrowserImpl::OnHistoryReload(nsIURI *theUri, PRUint32 reloadFlags
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CBrowserImpl::OnHistoryGotoIndex(PRInt32 theIndex, nsIURI *theUri, PRBool *notify)
|
||||
NS_IMETHODIMP CBrowserImpl::OnHistoryGotoIndex(PRInt32 theIndex, nsIURI *theURI, PRBool *notify)
|
||||
{
|
||||
QAOutput("nsIHistoryListener::OnHistoryGotoIndex()", 2);
|
||||
|
||||
GetTheUri(theUri, 1);
|
||||
GetTheURI(theURI, 1);
|
||||
*notify = PR_TRUE;
|
||||
FormatAndPrintOutput("OnHistoryGotoIndex() notification = ", *notify, 1);
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ NS_IMETHODIMP CBrowserImpl::OnLocationChange(nsIWebProgress* aWebProgress,
|
|||
QAOutput("Entering nsIWebProgLstnr::OnLocationChange().");
|
||||
|
||||
// test nsIURI parameter
|
||||
GetTheUri(location, 1);
|
||||
GetTheURI(location, 1);
|
||||
|
||||
RequestName(aRequest, stringMsg);
|
||||
|
||||
|
|
|
@ -55,7 +55,9 @@
|
|||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
storage getSupportObj;
|
||||
|
||||
void RvTestResultDlg(nsresult rv, CString pLine,BOOL bClearList)
|
||||
{
|
||||
|
@ -401,7 +403,7 @@ nsIDOMWindow * GetTheDOMWindow(nsIWebBrowser *webBrowser)
|
|||
return (theDOMWindow);
|
||||
}
|
||||
|
||||
nsCAutoString GetTheUri(nsIURI *theURI, int displayMethod)
|
||||
nsCAutoString GetTheURI(nsIURI *theURI, int displayMethod)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCAutoString uriString;
|
||||
|
@ -432,6 +434,11 @@ void onStateChangeString(char *theStateType, char *theDocType,
|
|||
totalMsg += ", status (hex) = ";
|
||||
totalMsg.AppendInt(status, 16);
|
||||
QAOutput(totalMsg.get(), displayMode);
|
||||
}
|
||||
|
||||
void SaveObject(nsISupports *theSupports)
|
||||
{
|
||||
getSupportObj.sup = theSupports;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -64,15 +64,15 @@ extern void FormatAndPrintOutput(const char *, PRUint32, int);
|
|||
extern void RequestName(nsIRequest *, nsCString &, int displayMethod=1);
|
||||
extern void WebProgDOMWindowTest(nsIWebProgress *, const char *,int displayMethod=1);
|
||||
extern void WebProgIsDocLoadingTest(nsIWebProgress *, const char *, int displayMethod=1);
|
||||
extern void SaveObject(nsISupports *theSupports);
|
||||
extern nsIDOMWindow * GetTheDOMWindow(nsIWebBrowser *);
|
||||
extern nsCAutoString GetTheUri(nsIURI *theUri, int displayMethod=1);
|
||||
extern nsCAutoString GetTheURI(nsIURI *theURI, int displayMethod=1);
|
||||
extern void onStateChangeString(char *, char *, nsCString, PRUint32, int displayMethod=1);
|
||||
extern nsresult rv;
|
||||
|
||||
#endif //_QAUTILS_H/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
// CShowTestResults dialog
|
||||
class CShowTestResults : public CDialog
|
||||
{
|
||||
|
@ -105,6 +105,11 @@ protected:
|
|||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
nsCOMPtr<nsISupports> sup;
|
||||
}storage;
|
||||
|
||||
|
||||
|
|
|
@ -585,7 +585,7 @@ void CTests::OnTestsAddUriContentListenerByOpenUri()
|
|||
rv = NS_NewURI(getter_AddRefs(theURI), theStr);
|
||||
RvTestResult(rv, "For OpenURI(): NS_NewURI() test", 1);
|
||||
FormatAndPrintOutput("theStr = ", theStr, 1);
|
||||
GetTheUri(theURI, 1);
|
||||
GetTheURI(theURI, 1);
|
||||
rv = NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, nsnull);
|
||||
RvTestResult(rv, "For OpenURI(): NS_NewChannel() test", 1);
|
||||
}
|
||||
|
@ -652,7 +652,7 @@ void CTests::OnTestsIOServiceNewURI()
|
|||
if (!theURI)
|
||||
QAOutput("We didn't get the nsIURI object for IOService test.", 2);
|
||||
else {
|
||||
retURI = GetTheUri(theURI, 1);
|
||||
retURI = GetTheURI(theURI, 1);
|
||||
FormatAndPrintOutput("The ioService->NewURI() output uri = ", retURI, 2);
|
||||
}
|
||||
}
|
||||
|
@ -697,7 +697,7 @@ void CTests::OnTestsProtocolHandlerNewURI()
|
|||
|
||||
RvTestResult(rv, "protocolHandler->NewURI() test", 2);
|
||||
|
||||
retStr = GetTheUri(theReturnURI, 1);
|
||||
retStr = GetTheURI(theReturnURI, 1);
|
||||
|
||||
// simple string compare to see if input & output URLs match
|
||||
if (strcmp(myDialog.m_urlfield, retStr.get()) == 0)
|
||||
|
@ -810,7 +810,7 @@ void CTests::OnToolsRemoveAllGH()
|
|||
|
||||
void CTests::OnToolsViewLogfile()
|
||||
{
|
||||
char theUri[1024];
|
||||
char theURI[1024];
|
||||
|
||||
CStdioFile myFile;
|
||||
CFileException e;
|
||||
|
@ -819,8 +819,8 @@ void CTests::OnToolsViewLogfile()
|
|||
| CStdioFile::modeNoTruncate, &e );
|
||||
myFile.Close();
|
||||
|
||||
strcpy(theUri, "file://C|/temp/TestOutput.txt");
|
||||
rv = qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theUri).get(),
|
||||
strcpy(theURI, "file://C|/temp/TestOutput.txt");
|
||||
rv = qaWebNav->LoadURI(NS_ConvertASCIItoUCS2(theURI).get(),
|
||||
nsIWebNavigation::LOAD_FLAGS_NONE, nsnull,nsnull, nsnull);
|
||||
}
|
||||
|
||||
|
@ -893,7 +893,7 @@ void CTests::OnVerifybugs169617()
|
|||
rv = NS_NewURI(getter_AddRefs(theURI), theStr);
|
||||
RvTestResult(rv, "NS_NewURI() test for file url", 1);
|
||||
|
||||
GetTheUri(theURI, 1);
|
||||
GetTheURI(theURI, 1);
|
||||
|
||||
rv = NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, nsnull);
|
||||
RvTestResult(rv, "NS_NewChannel() test for file url", 1);
|
||||
|
@ -914,7 +914,7 @@ void CTests::OnVerifybugs170274()
|
|||
rv = NS_NewURI(getter_AddRefs(theURI), theStr);
|
||||
RvTestResult(rv, "NS_NewURI() test for data url", 1);
|
||||
|
||||
GetTheUri(theURI, 1);
|
||||
GetTheURI(theURI, 1);
|
||||
|
||||
rv = NS_NewChannel(getter_AddRefs(theChannel), theURI, nsnull, nsnull);
|
||||
RvTestResult(rv, "NS_NewChannel() test for data url", 1);
|
||||
|
|
|
@ -113,13 +113,13 @@ void CNsIWebNav::OnStartTests(UINT nMenuID)
|
|||
GoToIndexTest(2);
|
||||
break ;
|
||||
case ID_INTERFACES_NSIWEBNAV_LOADURI :
|
||||
LoadUriTest(nsnull, nsnull, 2, PR_FALSE);
|
||||
LoadURITest(nsnull, nsnull, 2, PR_FALSE);
|
||||
break ;
|
||||
case ID_INTERFACES_NSIWEBNAV_RELOAD :
|
||||
ReloadTest(nsIWebNavigation::LOAD_FLAGS_NONE, 2);
|
||||
break ;
|
||||
case ID_INTERFACES_NSIWEBNAV_STOP :
|
||||
StopUriTest("file://C|/Program Files",
|
||||
StopURITest("file://C|/Program Files",
|
||||
nsIWebNavigation::STOP_CONTENT, 2);
|
||||
break ;
|
||||
case ID_INTERFACES_NSIWEBNAV_GETDOCUMENT :
|
||||
|
@ -152,8 +152,8 @@ void CNsIWebNav::RunAllTests()
|
|||
}
|
||||
|
||||
// load a couple of URLs to get things going
|
||||
LoadUriTest("http://www.cisco.com", nsIWebNavigation::LOAD_FLAGS_NONE, 2, PR_TRUE);
|
||||
LoadUriTest("www.google.com", nsIWebNavigation::LOAD_FLAGS_NONE, 2, PR_TRUE);
|
||||
LoadURITest("http://www.cisco.com", nsIWebNavigation::LOAD_FLAGS_NONE, 2, PR_TRUE);
|
||||
LoadURITest("www.google.com", nsIWebNavigation::LOAD_FLAGS_NONE, 2, PR_TRUE);
|
||||
|
||||
// canGoBack attribute test
|
||||
CanGoBackTest(1);
|
||||
|
@ -179,9 +179,9 @@ void CNsIWebNav::RunAllTests()
|
|||
|
||||
|
||||
// Stop() tests
|
||||
StopUriTest("http://www.microsoft.com", nsIWebNavigation::STOP_ALL, 1);
|
||||
StopUriTest("https://www.microsoft.com/", nsIWebNavigation::STOP_NETWORK, 1);
|
||||
StopUriTest("ftp://ftp.microsoft.com/", nsIWebNavigation::STOP_CONTENT, 1);
|
||||
StopURITest("http://www.microsoft.com", nsIWebNavigation::STOP_ALL, 1);
|
||||
StopURITest("https://www.microsoft.com/", nsIWebNavigation::STOP_NETWORK, 1);
|
||||
StopURITest("ftp://ftp.microsoft.com/", nsIWebNavigation::STOP_CONTENT, 1);
|
||||
|
||||
// document test
|
||||
GetDocumentTest(1);
|
||||
|
@ -206,7 +206,7 @@ void CNsIWebNav::LoadUriandReload(int URItotal)
|
|||
{
|
||||
for (i=0; i < URItotal; i++)
|
||||
{
|
||||
LoadUriTest(UrlTable[i].theUri, UrlTable[j].theFlag, 2, PR_TRUE);
|
||||
LoadURITest(UrlTable[i].theURI, UrlTable[j].theFlag, 2, PR_TRUE);
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
|
@ -274,7 +274,7 @@ void CNsIWebNav::GoToIndexTest(PRInt16 displayMode)
|
|||
RvTestResult(rv, "GotoIndex() test", displayMode);
|
||||
}
|
||||
|
||||
void CNsIWebNav::LoadUriTest(char *theUrl, PRUint32 theFlag,
|
||||
void CNsIWebNav::LoadURITest(char *theUrl, PRUint32 theFlag,
|
||||
PRInt16 displayMode, PRBool runAllTests)
|
||||
{
|
||||
char theTotalString[500];
|
||||
|
@ -381,7 +381,7 @@ void CNsIWebNav::ReloadTest(PRUint32 theFlag, PRInt16 displayMode)
|
|||
RvTestResult(rv, theTotalString, displayMode);
|
||||
}
|
||||
|
||||
void CNsIWebNav::StopUriTest(char *theUrl, PRUint32 theFlag,
|
||||
void CNsIWebNav::StopURITest(char *theUrl, PRUint32 theFlag,
|
||||
PRInt16 displayMode)
|
||||
{
|
||||
char theTotalString[200];
|
||||
|
|
|
@ -71,10 +71,10 @@ public:
|
|||
void CanGoForwardTest(PRInt16);
|
||||
void GoForwardTest(PRInt16);
|
||||
void GoToIndexTest(PRInt16);
|
||||
void LoadUriTest(char *, PRUint32, PRInt16 displayMode=1,
|
||||
void LoadURITest(char *, PRUint32, PRInt16 displayMode=1,
|
||||
PRBool runAllTests=PR_FALSE);
|
||||
void ReloadTest(PRUint32, PRInt16);
|
||||
void StopUriTest(char *, PRUint32, PRInt16);
|
||||
void StopURITest(char *, PRUint32, PRInt16);
|
||||
void GetDocumentTest(PRInt16);
|
||||
void GetCurrentURITest(PRInt16);
|
||||
void GetReferringURITest(PRInt16);
|
||||
|
@ -95,7 +95,7 @@ protected:
|
|||
|
||||
typedef struct
|
||||
{
|
||||
char theUri[1024];
|
||||
char theURI[1024];
|
||||
unsigned long theFlag;
|
||||
} NavElement;
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ void CNsIHistory::OnStartTests(UINT nMenuID)
|
|||
nsCOMPtr<nsISimpleEnumerator> theSimpleEnum;
|
||||
|
||||
|
||||
//nsCOMPtr<nsIURI> theUri;
|
||||
//nsCOMPtr<nsIURI> theURI;
|
||||
// do_QueryInterface
|
||||
// NS_HISTORYENTRY_CONTRACTID
|
||||
// NS_SHISTORYLISTENER_CONTRACTID
|
||||
|
@ -376,15 +376,15 @@ void CNsIHistory::GetMaxLengthTest(nsISHistory *theSessionHistory, PRInt32 *theM
|
|||
void CNsIHistory::GetURIHistTest(nsIHistoryEntry* theHistoryEntry,
|
||||
PRInt16 displayMode)
|
||||
{
|
||||
rv = theHistoryEntry->GetURI(getter_AddRefs(theUri));
|
||||
rv = theHistoryEntry->GetURI(getter_AddRefs(theURI));
|
||||
RvTestResult(rv, "GetURI() (URI attribute) test", 1);
|
||||
RvTestResultDlg(rv, "GetURI() (URI attribute) test");
|
||||
if (!theUri)
|
||||
QAOutput("theUri for GetURI() invalid. Test failed.", 1);
|
||||
if (!theURI)
|
||||
QAOutput("theURI for GetURI() invalid. Test failed.", 1);
|
||||
else
|
||||
{
|
||||
nsCAutoString uriString;
|
||||
rv = theUri->GetSpec(uriString);
|
||||
rv = theURI->GetSpec(uriString);
|
||||
if (NS_FAILED(rv))
|
||||
QAOutput("We didn't get the uriString.", 1);
|
||||
else
|
||||
|
@ -448,11 +448,11 @@ void CNsIHistory::SimpleEnumTest(nsISimpleEnumerator *theSimpleEnum,
|
|||
nextHistoryEntry = do_QueryInterface(nextObj);
|
||||
if (!nextHistoryEntry)
|
||||
continue;
|
||||
rv = nextHistoryEntry->GetURI(getter_AddRefs(theUri));
|
||||
rv = nextHistoryEntry->GetURI(getter_AddRefs(theURI));
|
||||
RvTestResult(rv, "theSimpleEnum nsIHistoryEntry->GetURI() test", 1);
|
||||
RvTestResultDlg(rv, "theSimpleEnum nsIHistoryEntry->GetURI() test");
|
||||
nsCAutoString uriString;
|
||||
rv = theUri->GetSpec(uriString);
|
||||
rv = theURI->GetSpec(uriString);
|
||||
if (NS_FAILED(rv))
|
||||
QAOutput("uriString for GetSpec() invalid. Test failed.", 1);
|
||||
else
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
// Mozilla interfaces
|
||||
//
|
||||
nsCOMPtr<nsIWebNavigation> qaWebNav;
|
||||
nsCOMPtr<nsIURI> theUri;
|
||||
nsCOMPtr<nsIURI> theURI;
|
||||
//CTests *qaTests ;
|
||||
|
||||
public:
|
||||
|
|
|
@ -154,7 +154,7 @@ void CnsIChannelTests::GetOriginalURITest(nsIChannel *theChannel, PRInt16 displa
|
|||
QAOutput("Didn't get URI object. GetOriginalURITest failed.", displayMode);
|
||||
return;
|
||||
}
|
||||
GetTheUri(theURI);
|
||||
GetTheURI(theURI);
|
||||
}
|
||||
|
||||
void CnsIChannelTests::GetURITest(nsIChannel *theChannel, PRInt16 displayMode)
|
||||
|
@ -173,7 +173,7 @@ void CnsIChannelTests::GetURITest(nsIChannel *theChannel, PRInt16 displayMode)
|
|||
QAOutput("Didn't get URI object. GetURITest failed.", displayMode);
|
||||
return;
|
||||
}
|
||||
GetTheUri(theURI);
|
||||
GetTheURI(theURI);
|
||||
}
|
||||
|
||||
void CnsIChannelTests::SetOwnerTest(nsIChannel *theChannel, PRInt16 displayMode)
|
||||
|
@ -370,11 +370,7 @@ void CnsIChannelTests::AsyncOpenTest(nsIChannel *theChannel, PRInt16 displayMode
|
|||
if (!theSupports)
|
||||
QAOutput("Didn't get the nsISupports object. AsyncOpen() failed.", displayMode);
|
||||
|
||||
if (theSupports == theChannel)
|
||||
QAOutput("Supports = Channel.", displayMode);
|
||||
else
|
||||
QAOutput("Supports != Channel.", displayMode);
|
||||
|
||||
SaveObject(theSupports);
|
||||
|
||||
rv = theChannel->AsyncOpen(listener, theSupports);
|
||||
RvTestResult(rv, "AsyncOpen()", displayMode);
|
||||
|
|
|
@ -91,7 +91,7 @@ Element ReqTable[] = {
|
|||
{"file://C|/Program Files/", 1, 1, 1, 1, 0, 1, 1},
|
||||
{"ftp://ftp.netscape.com/", 1, 1, 1, 1, 0, 1, 1},
|
||||
{"ftp://ftp.mozilla.org/", 0, 0, 0, 0, 1, 0, 0},
|
||||
};
|
||||
};
|
||||
|
||||
void CNsIRequest::OnStartTests(UINT nMenuID)
|
||||
{
|
||||
|
@ -231,7 +231,7 @@ nsIChannel * CNsIRequest::GetTheChannel(int i, nsILoadGroup *theLoadGroup)
|
|||
return nsnull;
|
||||
}
|
||||
else {
|
||||
retURI = GetTheUri(theURI, 1);
|
||||
retURI = GetTheURI(theURI, 1);
|
||||
// simple string compare to see if input & output URLs match
|
||||
if (strcmp(ReqTable[i].theUrl, retURI.get()) == 0)
|
||||
QAOutput("The in/out URIs MATCH.", 1);
|
||||
|
|
Загрузка…
Ссылка в новой задаче