From f909bc6a35b5aa70e4e169780a68f2c8bc7b96eb Mon Sep 17 00:00:00 2001 From: "depstein%netscape.com" Date: Sat, 28 Sep 2002 22:09:28 +0000 Subject: [PATCH] Added nsIProtocolHandler->NewURI() test to the Tests menu. a=asa for checkins not part of the default build. git-svn-id: svn://10.0.0.236/trunk@130689 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/embedding/qa/testembed/Tests.cpp | 41 ++++++++++++++++++ mozilla/embedding/qa/testembed/Tests.h | 1 + mozilla/embedding/qa/testembed/nsirequest.cpp | 3 +- mozilla/embedding/qa/testembed/resource.h | 3 +- mozilla/embedding/qa/testembed/testembed.aps | Bin 718 -> 718 bytes mozilla/embedding/qa/testembed/testembed.rc | 3 ++ 6 files changed, 48 insertions(+), 3 deletions(-) diff --git a/mozilla/embedding/qa/testembed/Tests.cpp b/mozilla/embedding/qa/testembed/Tests.cpp index 347a4e0fe20..c58cdcb5219 100644 --- a/mozilla/embedding/qa/testembed/Tests.cpp +++ b/mozilla/embedding/qa/testembed/Tests.cpp @@ -97,6 +97,7 @@ BEGIN_MESSAGE_MAP(CTests, CWnd) ON_COMMAND(ID_TESTS_ADDURICONTENTLISTENER_OPENURI, OnTestsAddUriContentListenerByOpenUri) ON_COMMAND(ID_TESTS_NSNEWCHANNEL, OnTestsNSNewChannelAndAsyncOpen) ON_COMMAND(ID_TESTS_NSIIOSERVICENEWURI, OnTestsIOServiceNewURI) + ON_COMMAND(ID_TESTS_NSIPROTOCOLHANDLERNEWURI, OnTestsProtocolHandlerNewURI) ON_COMMAND(ID_TOOLS_REMOVEGHPAGE, OnToolsRemoveGHPage) ON_COMMAND(ID_TOOLS_REMOVEALLGH, OnToolsRemoveAllGH) ON_COMMAND(ID_TOOLS_TESTYOURMETHOD, OnToolsTestYourMethod) @@ -608,6 +609,46 @@ void CTests::OnTestsIOServiceNewURI() } } +// ********************************************************* + +void CTests::OnTestsProtocolHandlerNewURI() +{ + nsCOMPtr ioService(do_GetIOService(&rv)); + if (!ioService) { + QAOutput("We didn't get the IOService object.", 2); + return; + } + + if (myDialog.DoModal() == IDOK) + { + nsCAutoString theStr, retStr; + nsCOMPtr theOriginalURI; + nsIURI *theReturnURI = nsnull; + + nsCOMPtr protocolHandler; + + theStr = myDialog.m_urlfield; + rv = ioService->GetProtocolHandler("http", getter_AddRefs(protocolHandler)); + RvTestResult(rv, "ioService->GetProtocolHandler() test", 2); + rv = qaWebNav->GetCurrentURI(getter_AddRefs(theOriginalURI)); + if (!protocolHandler) { + QAOutput("We didn't get the protocolHandler object.", 2); + return; + } + rv = protocolHandler->NewURI(theStr, nsnull, theOriginalURI, &theReturnURI); + if (!theOriginalURI) + QAOutput("We didn't get the original nsIURI object.", 2); + else if (!theReturnURI) + QAOutput("We didn't get the output nsIURI object.", 2); + RvTestResult(rv, "protocolHandler->NewURI() test", 2); + retStr = GetTheUri(theReturnURI, 1); + // simple string compare to see if input & output URLs match + if (strcmp(myDialog.m_urlfield, retStr.get()) == 0) + QAOutput("The in/out URIs MATCH.", 1); + else + QAOutput("The in/out URIs don't MATCH.", 1); + } +} // ********************************************************* // ********************************************************* // TOOLS to help us diff --git a/mozilla/embedding/qa/testembed/Tests.h b/mozilla/embedding/qa/testembed/Tests.h index cd4750273cc..a5fd25a45f3 100644 --- a/mozilla/embedding/qa/testembed/Tests.h +++ b/mozilla/embedding/qa/testembed/Tests.h @@ -118,6 +118,7 @@ protected: afx_msg void OnTestsAddUriContentListenerByOpenUri(); afx_msg void OnTestsNSNewChannelAndAsyncOpen(); afx_msg void OnTestsIOServiceNewURI(); + afx_msg void OnTestsProtocolHandlerNewURI(); afx_msg void OnInterfacesNsifile(); afx_msg void OnToolsRemoveGHPage(); afx_msg void OnToolsRemoveAllGH(); diff --git a/mozilla/embedding/qa/testembed/nsirequest.cpp b/mozilla/embedding/qa/testembed/nsirequest.cpp index 30d76f4dfb8..2b13e1dd1c1 100644 --- a/mozilla/embedding/qa/testembed/nsirequest.cpp +++ b/mozilla/embedding/qa/testembed/nsirequest.cpp @@ -70,7 +70,6 @@ CNsIRequest::~CNsIRequest() } - ///////////////////////////////////////////////////////////////////////////// // CNsIRequest message handlers // *********************************************************************** @@ -89,7 +88,7 @@ Element ReqTable[] = { {"http://www.aol.com/", 0, 1, 0, 0, 0, 1, 1}, {"https://www.yahoo.com/", 1, 1, 1, 1, 0, 1, 1}, {"data:text/plain;charset=iso-8859-7,%be%fg%be", - 1, 1, 1, 1, 0, 1, 1}, + 1, 1, 1, 1, 0, 1, 1}, {"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}, diff --git a/mozilla/embedding/qa/testembed/resource.h b/mozilla/embedding/qa/testembed/resource.h index 012f63bed7e..ea4a1e0261d 100644 --- a/mozilla/embedding/qa/testembed/resource.h +++ b/mozilla/embedding/qa/testembed/resource.h @@ -272,6 +272,7 @@ #define ID_VERIFYBUGS_169617 33002 #define ID_VERIFYBUGS_170274 33003 #define ID_TESTS_NSIIOSERVICENEWURI 33005 +#define ID_TESTS_NSIPROTOCOLHANDLERNEWURI 33006 #define ID_CLIPBOARDCMD_PASTE 42789 #define ID_CLIPBOARDCMD_COPYSELECTION 42790 #define ID_CLIPBOARDCMD_SELECTALL 42791 @@ -288,7 +289,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 153 -#define _APS_NEXT_COMMAND_VALUE 33006 +#define _APS_NEXT_COMMAND_VALUE 33007 #define _APS_NEXT_CONTROL_VALUE 1033 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/mozilla/embedding/qa/testembed/testembed.aps b/mozilla/embedding/qa/testembed/testembed.aps index 9f84101301999db9eb1f33b043daa57333abc718..d4bee6f4d5a34b200419e630552512cbbaecaa9b 100644 GIT binary patch delta 18 ZcmX@ddX9C13zI|UL^nIePa9i3nE*ic2Co1B delta 18 ZcmX@ddX9C13zJ61L^nIei5puznE*Zi1~mWx diff --git a/mozilla/embedding/qa/testembed/testembed.rc b/mozilla/embedding/qa/testembed/testembed.rc index 8166171db59..678e088d550 100644 --- a/mozilla/embedding/qa/testembed/testembed.rc +++ b/mozilla/embedding/qa/testembed/testembed.rc @@ -168,6 +168,9 @@ BEGIN END MENUITEM "NSNewChannel/AyncOpen", ID_TESTS_NSNEWCHANNEL MENUITEM "nsIIOService->NewURI()", ID_TESTS_NSIIOSERVICENEWURI + MENUITEM "nsIProtocolHandler->NewURI()", + ID_TESTS_NSIPROTOCOLHANDLERNEWURI + END POPUP "&Interfaces" BEGIN