mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 619623 - Try to fix some intermittent failures in test_IHistory.cpp.
r=dietrich
This commit is contained in:
parent
f2ecf7b606
commit
ed5a1cd872
@ -134,28 +134,23 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
WaitForTopicSpinner(const char* const aTopic)
|
||||
: mTopic(aTopic)
|
||||
, mTopicReceived(false)
|
||||
: mTopicReceived(false)
|
||||
, mStartTime(PR_IntervalNow())
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
|
||||
do_check_true(observerService);
|
||||
(void)observerService->AddObserver(this, aTopic, false);
|
||||
}
|
||||
|
||||
void Spin() {
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
|
||||
if (observerService) {
|
||||
(void)observerService->AddObserver(this, mTopic, false);
|
||||
|
||||
while (!mTopicReceived) {
|
||||
if (PR_IntervalNow() - mStartTime > WAITFORTOPIC_TIMEOUT_SECONDS * PR_USEC_PER_SEC) {
|
||||
// Timed out waiting for the topic.
|
||||
do_check_true(false);
|
||||
break;
|
||||
}
|
||||
(void)NS_ProcessNextEvent();
|
||||
while (!mTopicReceived) {
|
||||
if ((PR_IntervalNow() - mStartTime) > (WAITFORTOPIC_TIMEOUT_SECONDS * PR_USEC_PER_SEC)) {
|
||||
// Timed out waiting for the topic.
|
||||
do_check_true(false);
|
||||
break;
|
||||
}
|
||||
|
||||
(void)observerService->RemoveObserver(this, mTopic);
|
||||
(void)NS_ProcessNextEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,13 +158,15 @@ public:
|
||||
const char* aTopic,
|
||||
const PRUnichar* aData)
|
||||
{
|
||||
do_check_false(strcmp(aTopic, mTopic));
|
||||
mTopicReceived = true;
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
|
||||
do_check_true(observerService);
|
||||
(void)observerService->RemoveObserver(this, aTopic);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
const char* const mTopic;
|
||||
bool mTopicReceived;
|
||||
PRIntervalTime mStartTime;
|
||||
};
|
||||
@ -187,9 +184,11 @@ NS_IMPL_ISUPPORTS1(
|
||||
void
|
||||
addURI(nsIURI* aURI)
|
||||
{
|
||||
nsRefPtr<WaitForTopicSpinner> spinner =
|
||||
new WaitForTopicSpinner(TOPIC_FRECENCY_UPDATED);
|
||||
|
||||
nsCOMPtr<nsINavHistoryService> hist =
|
||||
do_GetService(NS_NAVHISTORYSERVICE_CONTRACTID);
|
||||
|
||||
PRInt64 id;
|
||||
nsresult rv = hist->AddVisit(aURI, PR_Now(), nsnull,
|
||||
nsINavHistoryService::TRANSITION_LINK, false,
|
||||
@ -197,8 +196,6 @@ addURI(nsIURI* aURI)
|
||||
do_check_success(rv);
|
||||
|
||||
// Wait for frecency update.
|
||||
nsRefPtr<WaitForTopicSpinner> spinner =
|
||||
new WaitForTopicSpinner(TOPIC_FRECENCY_UPDATED);
|
||||
spinner->Spin();
|
||||
}
|
||||
|
||||
@ -334,36 +331,24 @@ do_get_lastVisit(PRInt64 placeId, VisitRecord& result)
|
||||
|
||||
static const char TOPIC_PROFILE_TEARDOWN[] = "profile-change-teardown";
|
||||
static const char TOPIC_PROFILE_CHANGE[] = "profile-before-change";
|
||||
static const char TOPIC_PLACES_CONNECTION_CLOSED[] = "places-connection-closed";
|
||||
|
||||
class ShutdownObserver : public nsIObserver
|
||||
class ProfileScopedXPCOM : public ScopedXPCOM
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
ShutdownObserver()
|
||||
ProfileScopedXPCOM(const char* testName)
|
||||
: ScopedXPCOM(testName)
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
|
||||
do_check_true(observerService);
|
||||
observerService->AddObserver(this,
|
||||
NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID,
|
||||
false);
|
||||
}
|
||||
|
||||
NS_IMETHOD Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const PRUnichar* aData)
|
||||
{
|
||||
if (strcmp(aTopic, NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID) == 0) {
|
||||
nsCOMPtr<nsIObserverService> os =
|
||||
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
|
||||
(void)os->NotifyObservers(nsnull, TOPIC_PROFILE_TEARDOWN, nsnull);
|
||||
(void)os->NotifyObservers(nsnull, TOPIC_PROFILE_CHANGE, nsnull);
|
||||
}
|
||||
return NS_OK;
|
||||
~ProfileScopedXPCOM() {
|
||||
nsRefPtr<WaitForTopicSpinner> spinner =
|
||||
new WaitForTopicSpinner(TOPIC_PLACES_CONNECTION_CLOSED);
|
||||
nsCOMPtr<nsIObserverService> os =
|
||||
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
|
||||
(void)os->NotifyObservers(nsnull, TOPIC_PROFILE_TEARDOWN, nsnull);
|
||||
(void)os->NotifyObservers(nsnull, TOPIC_PROFILE_CHANGE, nsnull);
|
||||
// Wait for connection close.
|
||||
spinner->Spin();
|
||||
}
|
||||
};
|
||||
NS_IMPL_ISUPPORTS1(
|
||||
ShutdownObserver,
|
||||
nsIObserver
|
||||
)
|
||||
|
@ -114,9 +114,8 @@ int
|
||||
main(int aArgc,
|
||||
char** aArgv)
|
||||
{
|
||||
ScopedXPCOM xpcom(TEST_NAME);
|
||||
nsRefPtr<ShutdownObserver> shutdownObserver = new ShutdownObserver();
|
||||
|
||||
ProfileScopedXPCOM xpcom(TEST_NAME);
|
||||
nsCOMPtr<nsIFile> profile = xpcom.GetProfileDirectory();
|
||||
|
||||
// Tinderboxes are constantly on idle. Since idle tasks can interact with
|
||||
// tests, causing random failures, disable the idle service.
|
||||
|
@ -149,10 +149,10 @@ test_set_places_enabled()
|
||||
// sets the nsCOMPtr's to nsnull, freeing the reference.
|
||||
namespace test_unvisited_does_not_notify {
|
||||
nsCOMPtr<nsIURI> testURI;
|
||||
nsCOMPtr<Link> testLink;
|
||||
nsRefPtr<Link> testLink;
|
||||
}
|
||||
void
|
||||
test_unvisted_does_not_notify_part1()
|
||||
test_unvisited_does_not_notify_part1()
|
||||
{
|
||||
using namespace test_unvisited_does_not_notify;
|
||||
|
||||
@ -169,7 +169,7 @@ test_unvisted_does_not_notify_part1()
|
||||
testLink = new mock_Link(expect_no_visit);
|
||||
|
||||
// Now, register our Link to be notified.
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
nsresult rv = history->RegisterVisitedCallback(testURI, testLink);
|
||||
do_check_success(rv);
|
||||
|
||||
@ -181,29 +181,30 @@ void
|
||||
test_visited_notifies()
|
||||
{
|
||||
// First, we add our test URI to history.
|
||||
nsCOMPtr<nsIURI> testURI(new_test_uri());
|
||||
nsCOMPtr<nsIURI> testURI = new_test_uri();
|
||||
addURI(testURI);
|
||||
|
||||
// Create our test Link. The callback function will release the reference we
|
||||
// have on the Link.
|
||||
Link* link = new mock_Link(expect_visit);
|
||||
NS_ADDREF(link);
|
||||
nsRefPtr<Link> link = new mock_Link(expect_visit);
|
||||
|
||||
// Now, register our Link to be notified.
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
nsresult rv = history->RegisterVisitedCallback(testURI, link);
|
||||
do_check_success(rv);
|
||||
|
||||
link.forget(); // It will release itself when notified.
|
||||
// Note: test will continue upon notification.
|
||||
}
|
||||
|
||||
void
|
||||
test_unvisted_does_not_notify_part2()
|
||||
test_unvisited_does_not_notify_part2()
|
||||
{
|
||||
using namespace test_unvisited_does_not_notify;
|
||||
|
||||
// We would have had a failure at this point had the content node been told it
|
||||
// was visited. Therefore, it is safe to unregister our content node.
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
nsresult rv = history->UnregisterVisitedCallback(testURI, testLink);
|
||||
do_check_success(rv);
|
||||
|
||||
@ -219,24 +220,24 @@ void
|
||||
test_same_uri_notifies_both()
|
||||
{
|
||||
// First, we add our test URI to history.
|
||||
nsCOMPtr<nsIURI> testURI(new_test_uri());
|
||||
nsCOMPtr<nsIURI> testURI = new_test_uri();
|
||||
addURI(testURI);
|
||||
|
||||
// Create our two test Links. The callback function will release the
|
||||
// reference we have on the Links. Only the second Link should run the next
|
||||
// test!
|
||||
Link* link1 = new mock_Link(expect_visit, false);
|
||||
NS_ADDREF(link1);
|
||||
Link* link2 = new mock_Link(expect_visit);
|
||||
NS_ADDREF(link2);
|
||||
nsRefPtr<Link> link1 = new mock_Link(expect_visit, false);
|
||||
nsRefPtr<Link> link2 = new mock_Link(expect_visit);
|
||||
|
||||
// Now, register our Link to be notified.
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
nsresult rv = history->RegisterVisitedCallback(testURI, link1);
|
||||
do_check_success(rv);
|
||||
rv = history->RegisterVisitedCallback(testURI, link2);
|
||||
do_check_success(rv);
|
||||
|
||||
link1.forget(); // It will release itself when notified.
|
||||
link2.forget(); // It will release itself when notified.
|
||||
// Note: test will continue upon notification.
|
||||
}
|
||||
|
||||
@ -247,8 +248,8 @@ test_unregistered_visited_does_not_notify()
|
||||
// The Link would have been notified by now if we were buggy and notified
|
||||
// unregistered Links (due to request serialization).
|
||||
|
||||
nsCOMPtr<nsIURI> testURI(new_test_uri());
|
||||
nsCOMPtr<Link> link(new mock_Link(expect_no_visit));
|
||||
nsCOMPtr<nsIURI> testURI = new_test_uri();
|
||||
nsRefPtr<Link> link = new mock_Link(expect_no_visit);
|
||||
|
||||
// Now, register our Link to be notified.
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
@ -276,18 +277,18 @@ test_new_visit_notifies_waiting_Link()
|
||||
{
|
||||
// Create our test Link. The callback function will release the reference we
|
||||
// have on the link.
|
||||
Link* link = new mock_Link(expect_visit);
|
||||
NS_ADDREF(link);
|
||||
nsRefPtr<Link> link = new mock_Link(expect_visit);
|
||||
|
||||
// Now, register our content node to be notified.
|
||||
nsCOMPtr<nsIURI> testURI(new_test_uri());
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<nsIURI> testURI = new_test_uri();
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
nsresult rv = history->RegisterVisitedCallback(testURI, link);
|
||||
do_check_success(rv);
|
||||
|
||||
// Add ourselves to history.
|
||||
addURI(testURI);
|
||||
|
||||
link.forget(); // It will release itself when notified.
|
||||
// Note: test will continue upon notification.
|
||||
}
|
||||
|
||||
@ -295,14 +296,14 @@ void
|
||||
test_RegisterVisitedCallback_returns_before_notifying()
|
||||
{
|
||||
// Add a URI so that it's already in history.
|
||||
nsCOMPtr<nsIURI> testURI(new_test_uri());
|
||||
nsCOMPtr<nsIURI> testURI = new_test_uri();
|
||||
addURI(testURI);
|
||||
|
||||
// Create our test Link.
|
||||
nsCOMPtr<Link> link(new mock_Link(expect_no_visit));
|
||||
nsRefPtr<Link> link = new mock_Link(expect_no_visit);
|
||||
|
||||
// Now, register our content node to be notified. It should not be notified.
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
nsresult rv = history->RegisterVisitedCallback(testURI, link);
|
||||
do_check_success(rv);
|
||||
|
||||
@ -346,8 +347,9 @@ namespace test_observer_topic_dispatched_helpers {
|
||||
do_check_false(strcmp(aTopic, URI_VISITED_RESOLUTION_TOPIC));
|
||||
|
||||
// If this isn't for our URI, do not do anything.
|
||||
nsCOMPtr<nsIURI> notifiedURI(do_QueryInterface(aSubject));
|
||||
nsCOMPtr<nsIURI> notifiedURI = do_QueryInterface(aSubject);
|
||||
do_check_true(notifiedURI);
|
||||
|
||||
bool isOurURI;
|
||||
nsresult rv = notifiedURI->Equals(mURI, &isOurURI);
|
||||
do_check_success(rv);
|
||||
@ -361,7 +363,9 @@ namespace test_observer_topic_dispatched_helpers {
|
||||
do_check_true(visited || notVisited);
|
||||
|
||||
// Check to make sure we got the state we expected.
|
||||
do_check_eq(visited, mExpectVisit);
|
||||
if (visited != mExpectVisit) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Indicate that we've been notified.
|
||||
mNotified = true;
|
||||
@ -389,8 +393,8 @@ test_observer_topic_dispatched()
|
||||
using namespace test_observer_topic_dispatched_helpers;
|
||||
|
||||
// Create two URIs, making sure only one is in history.
|
||||
nsCOMPtr<nsIURI> visitedURI(new_test_uri());
|
||||
nsCOMPtr<nsIURI> notVisitedURI(new_test_uri());
|
||||
nsCOMPtr<nsIURI> visitedURI = new_test_uri();
|
||||
nsCOMPtr<nsIURI> notVisitedURI = new_test_uri();
|
||||
bool urisEqual;
|
||||
nsresult rv = visitedURI->Equals(notVisitedURI, &urisEqual);
|
||||
do_check_success(rv);
|
||||
@ -398,21 +402,21 @@ test_observer_topic_dispatched()
|
||||
addURI(visitedURI);
|
||||
|
||||
// Need two Link objects as well - one for each URI.
|
||||
nsCOMPtr<Link> visitedLink(new mock_Link(expect_visit, false));
|
||||
nsCOMPtr<Link> visitedLinkCopy = visitedLink;
|
||||
nsRefPtr<Link> visitedLink = new mock_Link(expect_visit, false);
|
||||
nsRefPtr<Link> visitedLinkCopy = visitedLink;
|
||||
visitedLinkCopy.forget(); // It will release itself when notified.
|
||||
nsCOMPtr<Link> notVisitedLink(new mock_Link(expect_no_visit));
|
||||
nsRefPtr<Link> notVisitedLink = new mock_Link(expect_no_visit);
|
||||
|
||||
// Add the right observers for the URIs to check results.
|
||||
bool visitedNotified = false;
|
||||
nsCOMPtr<nsIObserver> vistedObs =
|
||||
nsCOMPtr<nsIObserver> visitedObs =
|
||||
new statusObserver(visitedURI, true, visitedNotified);
|
||||
bool notVisitedNotified = false;
|
||||
nsCOMPtr<nsIObserver> unvistedObs =
|
||||
nsCOMPtr<nsIObserver> unvisitedObs =
|
||||
new statusObserver(notVisitedURI, false, notVisitedNotified);
|
||||
|
||||
// Register our Links to be notified.
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
rv = history->RegisterVisitedCallback(visitedURI, visitedLink);
|
||||
do_check_success(rv);
|
||||
rv = history->RegisterVisitedCallback(notVisitedURI, notVisitedLink);
|
||||
@ -433,13 +437,13 @@ test_observer_topic_dispatched()
|
||||
void
|
||||
test_visituri_inserts()
|
||||
{
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<nsIURI> lastURI(new_test_uri());
|
||||
nsCOMPtr<nsIURI> visitedURI(new_test_uri());
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
nsCOMPtr<nsIURI> lastURI = new_test_uri();
|
||||
nsCOMPtr<nsIURI> visitedURI = new_test_uri();
|
||||
|
||||
history->VisitURI(visitedURI, lastURI, mozilla::IHistory::TOP_LEVEL);
|
||||
|
||||
nsCOMPtr<VisitURIObserver> finisher = new VisitURIObserver();
|
||||
nsRefPtr<VisitURIObserver> finisher = new VisitURIObserver();
|
||||
finisher->WaitForNotification();
|
||||
|
||||
PlaceRecord place;
|
||||
@ -456,10 +460,10 @@ test_visituri_inserts()
|
||||
void
|
||||
test_visituri_updates()
|
||||
{
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<nsIURI> lastURI(new_test_uri());
|
||||
nsCOMPtr<nsIURI> visitedURI(new_test_uri());
|
||||
nsCOMPtr<VisitURIObserver> finisher;
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
nsCOMPtr<nsIURI> lastURI = new_test_uri();
|
||||
nsCOMPtr<nsIURI> visitedURI = new_test_uri();
|
||||
nsRefPtr<VisitURIObserver> finisher;
|
||||
|
||||
history->VisitURI(visitedURI, lastURI, mozilla::IHistory::TOP_LEVEL);
|
||||
finisher = new VisitURIObserver();
|
||||
@ -480,16 +484,16 @@ test_visituri_updates()
|
||||
void
|
||||
test_visituri_preserves_shown_and_typed()
|
||||
{
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<nsIURI> lastURI(new_test_uri());
|
||||
nsCOMPtr<nsIURI> visitedURI(new_test_uri());
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
nsCOMPtr<nsIURI> lastURI = new_test_uri();
|
||||
nsCOMPtr<nsIURI> visitedURI = new_test_uri();
|
||||
|
||||
history->VisitURI(visitedURI, lastURI, mozilla::IHistory::TOP_LEVEL);
|
||||
// this simulates the uri visit happening in a frame. Normally frame
|
||||
// transitions would be hidden unless it was previously loaded top-level
|
||||
history->VisitURI(visitedURI, lastURI, 0);
|
||||
|
||||
nsCOMPtr<VisitURIObserver> finisher = new VisitURIObserver(2);
|
||||
nsRefPtr<VisitURIObserver> finisher = new VisitURIObserver(2);
|
||||
finisher->WaitForNotification();
|
||||
|
||||
PlaceRecord place;
|
||||
@ -502,12 +506,12 @@ test_visituri_preserves_shown_and_typed()
|
||||
void
|
||||
test_visituri_creates_visit()
|
||||
{
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<nsIURI> lastURI(new_test_uri());
|
||||
nsCOMPtr<nsIURI> visitedURI(new_test_uri());
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
nsCOMPtr<nsIURI> lastURI = new_test_uri();
|
||||
nsCOMPtr<nsIURI> visitedURI = new_test_uri();
|
||||
|
||||
history->VisitURI(visitedURI, lastURI, mozilla::IHistory::TOP_LEVEL);
|
||||
nsCOMPtr<VisitURIObserver> finisher = new VisitURIObserver();
|
||||
nsRefPtr<VisitURIObserver> finisher = new VisitURIObserver();
|
||||
finisher->WaitForNotification();
|
||||
|
||||
PlaceRecord place;
|
||||
@ -527,13 +531,13 @@ test_visituri_transition_typed()
|
||||
{
|
||||
nsCOMPtr<nsINavHistoryService> navHistory = do_get_NavHistory();
|
||||
nsCOMPtr<nsIBrowserHistory> browserHistory = do_QueryInterface(navHistory);
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<nsIURI> lastURI(new_test_uri());
|
||||
nsCOMPtr<nsIURI> visitedURI(new_test_uri());
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
nsCOMPtr<nsIURI> lastURI = new_test_uri();
|
||||
nsCOMPtr<nsIURI> visitedURI = new_test_uri();
|
||||
|
||||
browserHistory->MarkPageAsTyped(visitedURI);
|
||||
history->VisitURI(visitedURI, lastURI, mozilla::IHistory::TOP_LEVEL);
|
||||
nsCOMPtr<VisitURIObserver> finisher = new VisitURIObserver();
|
||||
nsRefPtr<VisitURIObserver> finisher = new VisitURIObserver();
|
||||
finisher->WaitForNotification();
|
||||
|
||||
PlaceRecord place;
|
||||
@ -551,12 +555,12 @@ test_visituri_transition_embed()
|
||||
{
|
||||
nsCOMPtr<nsINavHistoryService> navHistory = do_get_NavHistory();
|
||||
nsCOMPtr<nsIBrowserHistory> browserHistory = do_QueryInterface(navHistory);
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<nsIURI> lastURI(new_test_uri());
|
||||
nsCOMPtr<nsIURI> visitedURI(new_test_uri());
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
nsCOMPtr<nsIURI> lastURI = new_test_uri();
|
||||
nsCOMPtr<nsIURI> visitedURI = new_test_uri();
|
||||
|
||||
history->VisitURI(visitedURI, lastURI, 0);
|
||||
nsCOMPtr<VisitURIObserver> finisher = new VisitURIObserver();
|
||||
nsRefPtr<VisitURIObserver> finisher = new VisitURIObserver();
|
||||
finisher->WaitForNotification();
|
||||
|
||||
PlaceRecord place;
|
||||
@ -574,12 +578,12 @@ void
|
||||
test_new_visit_adds_place_guid()
|
||||
{
|
||||
// First, add a visit and wait. This will also add a place.
|
||||
nsCOMPtr<nsIURI> visitedURI(new_test_uri());
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<nsIURI> visitedURI = new_test_uri();
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
nsresult rv = history->VisitURI(visitedURI, NULL,
|
||||
mozilla::IHistory::TOP_LEVEL);
|
||||
do_check_success(rv);
|
||||
nsCOMPtr<VisitURIObserver> finisher = new VisitURIObserver();
|
||||
nsRefPtr<VisitURIObserver> finisher = new VisitURIObserver();
|
||||
finisher->WaitForNotification();
|
||||
|
||||
// Check that we have a guid for our visit.
|
||||
@ -600,9 +604,9 @@ test_two_null_links_same_uri()
|
||||
// Tests that we do not crash when we have had two NULL Links passed to
|
||||
// RegisterVisitedCallback and then the visit occurs (bug 607469). This only
|
||||
// happens in IPC builds.
|
||||
nsCOMPtr<nsIURI> testURI(new_test_uri());
|
||||
nsCOMPtr<nsIURI> testURI = new_test_uri();
|
||||
|
||||
nsCOMPtr<IHistory> history(do_get_IHistory());
|
||||
nsCOMPtr<IHistory> history = do_get_IHistory();
|
||||
nsresult rv = history->RegisterVisitedCallback(testURI, NULL);
|
||||
do_check_success(rv);
|
||||
rv = history->RegisterVisitedCallback(testURI, NULL);
|
||||
@ -611,7 +615,7 @@ test_two_null_links_same_uri()
|
||||
rv = history->VisitURI(testURI, NULL, mozilla::IHistory::TOP_LEVEL);
|
||||
do_check_success(rv);
|
||||
|
||||
nsCOMPtr<VisitURIObserver> finisher = new VisitURIObserver();
|
||||
nsRefPtr<VisitURIObserver> finisher = new VisitURIObserver();
|
||||
finisher->WaitForNotification();
|
||||
|
||||
run_next_test();
|
||||
@ -625,9 +629,9 @@ test_two_null_links_same_uri()
|
||||
*/
|
||||
Test gTests[] = {
|
||||
TEST(test_set_places_enabled), // Must come first!
|
||||
TEST(test_unvisted_does_not_notify_part1), // Order Important!
|
||||
TEST(test_unvisited_does_not_notify_part1), // Order Important!
|
||||
TEST(test_visited_notifies),
|
||||
TEST(test_unvisted_does_not_notify_part2), // Order Important!
|
||||
TEST(test_unvisited_does_not_notify_part2), // Order Important!
|
||||
TEST(test_same_uri_notifies_both),
|
||||
TEST(test_unregistered_visited_does_not_notify), // Order Important!
|
||||
TEST(test_new_visit_notifies_waiting_Link),
|
||||
|
@ -194,8 +194,9 @@ class ScopedXPCOM : public nsIDirectoryServiceProvider2
|
||||
{
|
||||
// If we created a profile directory, we need to remove it.
|
||||
if (mProfD) {
|
||||
if (NS_FAILED(mProfD->Remove(true)))
|
||||
NS_WARNING("Problem removing profile direrctory");
|
||||
if (NS_FAILED(mProfD->Remove(true))) {
|
||||
NS_WARNING("Problem removing profile directory");
|
||||
}
|
||||
|
||||
mProfD = nsnull;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user