From 3e91940e85cbf540067494594e8bc8c661fe74b4 Mon Sep 17 00:00:00 2001 From: "depstein%netscape.com" Date: Thu, 25 Oct 2001 18:32:34 +0000 Subject: [PATCH] Included SimpleEnumerator.h, added maxLength check for sHistory index, updated Observe() in TestEmbed.cpp to handle profile switching changes. git-svn-id: svn://10.0.0.236/trunk@106278 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/embedding/qa/testembed/StdAfx.h | 1 + mozilla/embedding/qa/testembed/TestEmbed.cpp | 8 ++++---- mozilla/embedding/qa/testembed/nsiHistory.cpp | 8 +++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/mozilla/embedding/qa/testembed/StdAfx.h b/mozilla/embedding/qa/testembed/StdAfx.h index 6ddba4abdc7..3d275970f6e 100644 --- a/mozilla/embedding/qa/testembed/StdAfx.h +++ b/mozilla/embedding/qa/testembed/StdAfx.h @@ -123,6 +123,7 @@ #include "nsIDOMWindowCollection.h" #include "nsISelection.h" #include "nsITooltipListener.h" +#include "nsISimpleEnumerator.h" //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. diff --git a/mozilla/embedding/qa/testembed/TestEmbed.cpp b/mozilla/embedding/qa/testembed/TestEmbed.cpp index 75111bc949c..64f244258b6 100644 --- a/mozilla/embedding/qa/testembed/TestEmbed.cpp +++ b/mozilla/embedding/qa/testembed/TestEmbed.cpp @@ -600,11 +600,11 @@ NS_IMPL_THREADSAFE_ISUPPORTS3(CTestEmbedApp, nsIObserver, nsIWindowCreator, nsIS // Mainly needed to support "on the fly" profile switching -NS_IMETHODIMP CTestEmbedApp::Observe(nsISupports *aSubject, const PRUnichar *aTopic, const PRUnichar *someData) +NS_IMETHODIMP CTestEmbedApp::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) { nsresult rv = NS_OK; - if (nsCRT::strcmp(aTopic, NS_LITERAL_STRING("profile-approve-change").get()) == 0) + if (nsCRT::strcmp(aTopic, "profile-approve-change") == 0) { // Ask the user if they want to int result = MessageBox(NULL, "Do you want to close all windows in order to switch the profile?", "Confirm", MB_YESNO | MB_ICONQUESTION); @@ -615,7 +615,7 @@ NS_IMETHODIMP CTestEmbedApp::Observe(nsISupports *aSubject, const PRUnichar *aTo status->VetoChange(); } } - else if (nsCRT::strcmp(aTopic, NS_LITERAL_STRING("profile-change-teardown").get()) == 0) + else if (nsCRT::strcmp(aTopic, "profile-change-teardown") == 0) { // Close all open windows. Alternatively, we could just call CBrowserWindow::Stop() // on each. Either way, we have to stop all network activity on this phase. @@ -636,7 +636,7 @@ NS_IMETHODIMP CTestEmbedApp::Observe(nsISupports *aSubject, const PRUnichar *aTo } } } - else if (nsCRT::strcmp(aTopic, NS_LITERAL_STRING("profile-after-change").get()) == 0) + else if (nsCRT::strcmp(aTopic, "profile-after-change") == 0) { InitializePrefs(); // In case we have just switched to a newly created profile. diff --git a/mozilla/embedding/qa/testembed/nsiHistory.cpp b/mozilla/embedding/qa/testembed/nsiHistory.cpp index 7b37dfad3f8..c500ceef399 100644 --- a/mozilla/embedding/qa/testembed/nsiHistory.cpp +++ b/mozilla/embedding/qa/testembed/nsiHistory.cpp @@ -92,7 +92,7 @@ void CNsIHistory::OnInterfacesNsishistory() PRInt32 numEntries = 5; PRInt32 theIndex; - PRInt32 theMaxLength = 100; + PRInt32 theMaxLength = 1; CString shString; @@ -138,6 +138,12 @@ void CNsIHistory::OnInterfacesNsishistory() QAOutput("We have the History Entry object!", 1); // getEntryAtIndex() tests + if (theMaxLength < numEntries) + { + QAOutput("Setting number of entries to maximum length!", 1); + numEntries = theMaxLength; + } + for (theIndex = 0; theIndex < numEntries; theIndex++) { FormatAndPrintOutput("the index = ", theIndex, 2);