M dist/mcp-test/src/test/java/cardemo/CarDemoTest.java
- this automated test is now a complete example for how to test an ajax web application in an automated fashion. M dom/classes/org/mozilla/dom/NodeImpl.java M dom/jni/org_mozilla_dom_NodeImpl.cpp - implement getTextContent() from DOM level 3. M webclient/build-tests.xml - add cardemoTest to unit test list as a place-holder until I can write a testcase that doesn't require the public Internet. A webclient/classes_spec/org/mozilla/mcp/AjaxListener.java - New class. Docs forthcoming. M webclient/classes_spec/org/mozilla/mcp/MCP.java - new methods to support complete ajax automated testing. M webclient/src_moz/AjaxListener.cpp M webclient/src_moz/AjaxListener.h - add mIsObserving flag. From our dtor, make sure to remove ourselves from the EmbedProgress. M webclient/src_moz/EmbedProgress.cpp M webclient/src_moz/EmbedProgress.h - We need to add ourselves as an observer both from SetCapturePageInfo and SetEventRegistration. M webclient/src_moz/NativeBrowserControl.cpp - Unit testing found a bug! We can't call mWindow->ReleaseChildren() until after we remove ourself as a listener. git-svn-id: svn://10.0.0.236/trunk@221594 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -90,6 +90,8 @@ EmbedProgress::SetEventRegistration(jobject yourEventRegistration)
|
||||
::util_ThrowExceptionToJava(env, "Exception: EmbedProgress->SetEventRegistration(): can't create NewGlobalRef\n\tfor eventRegistration");
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
// We get the listener here to ensure the mEventRegistration is
|
||||
// properly passed to the AjaxListener ctor.
|
||||
AjaxListener *observer = nsnull;
|
||||
rv = GetAjaxListener(&observer);
|
||||
if (observer && NS_SUCCEEDED(rv)) {
|
||||
@@ -108,7 +110,18 @@ nsresult
|
||||
EmbedProgress::SetCapturePageInfo(jboolean newState)
|
||||
{
|
||||
mCapturePageInfo = newState;
|
||||
return NS_OK;
|
||||
AjaxListener *observer = nsnull;
|
||||
nsresult rv = GetAjaxListener(&observer);
|
||||
if (observer && NS_SUCCEEDED(rv)) {
|
||||
if (mCapturePageInfo) {
|
||||
observer->StartObserving();
|
||||
}
|
||||
else {
|
||||
observer->StopObserving();
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@@ -505,7 +518,14 @@ EmbedProgress::GetAjaxListener(AjaxListener* *result)
|
||||
NS_IMETHODIMP
|
||||
EmbedProgress::RemoveAjaxListener(void)
|
||||
{
|
||||
nsresult rv = NS_ERROR_NOT_IMPLEMENTED;
|
||||
nsresult rv = NS_OK;
|
||||
AjaxListener *observer = nsnull;
|
||||
rv = GetAjaxListener(&observer);
|
||||
if (NS_SUCCEEDED(rv) && observer) {
|
||||
observer->StopObserving();
|
||||
mAjaxListener = nsnull;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user