Back to index

lightning-sunbird  0.9+nobinonly
TestScriptHelper.cpp
Go to the documentation of this file.
00001 // TestScriptHelper.cpp : Implementation of CTestScriptHelper
00002 #include "stdafx.h"
00003 #include "Cbrowse.h"
00004 #include "TestScriptHelper.h"
00005 
00007 // CTestScriptHelper
00008 
00009 
00010 STDMETHODIMP CTestScriptHelper::OutputString(BSTR bstrMessage)
00011 {
00012        AFX_MANAGE_STATE(AfxGetStaticModuleState())
00013 
00014        if (bstrMessage == NULL)
00015        {
00016               return E_INVALIDARG;
00017        }
00018        if (m_pBrowserInfo == NULL)
00019        {
00020               return E_UNEXPECTED;
00021        }
00022 
00023        USES_CONVERSION;
00024        m_pBrowserInfo->OutputString(OLE2T(bstrMessage));
00025        return S_OK;
00026 }
00027 
00028 
00029 STDMETHODIMP CTestScriptHelper::get_WebBrowser(LPDISPATCH *pVal)
00030 {
00031        AFX_MANAGE_STATE(AfxGetStaticModuleState())
00032 
00033        if (pVal == NULL)
00034        {
00035               return E_INVALIDARG;
00036        }
00037 
00038        *pVal = NULL;
00039        if (m_pBrowserInfo == NULL)
00040        {
00041               return E_UNEXPECTED;
00042        }
00043 
00044        CIPtr(IWebBrowserApp) spWebBrowserApp;
00045        m_pBrowserInfo->GetWebBrowser(&spWebBrowserApp);
00046        return spWebBrowserApp->QueryInterface(IID_IDispatch, (void **) pVal);
00047 }
00048 
00049 
00050 STDMETHODIMP CTestScriptHelper::put_Result(TestResult newVal)
00051 {
00052        AFX_MANAGE_STATE(AfxGetStaticModuleState())
00053 
00054        if (m_pBrowserInfo == NULL)
00055        {
00056               return E_UNEXPECTED;
00057        }
00058 
00059        m_pBrowserInfo->nResult = newVal;
00060 
00061        return S_OK;
00062 }
00063 
00064 
00065 STDMETHODIMP CTestScriptHelper::get_TestURL(BSTR *pVal)
00066 {
00067        AFX_MANAGE_STATE(AfxGetStaticModuleState())
00068 
00069        if (pVal == NULL)
00070        {
00071               return E_INVALIDARG;
00072        }
00073        if (m_pBrowserInfo)
00074        {
00075               USES_CONVERSION;
00076               *pVal = SysAllocString(T2OLE(m_pBrowserInfo->szTestURL));
00077        }
00078 
00079        return S_OK;
00080 }
00081 
00082 
00083 STDMETHODIMP CTestScriptHelper::get_TestCGI(BSTR *pVal)
00084 {
00085        AFX_MANAGE_STATE(AfxGetStaticModuleState())
00086 
00087        if (pVal == NULL)
00088        {
00089               return E_INVALIDARG;
00090        }
00091        if (m_pBrowserInfo)
00092        {
00093               USES_CONVERSION;
00094               *pVal = SysAllocString(T2OLE(m_pBrowserInfo->szTestCGI));
00095        }
00096 
00097        return S_OK;
00098 }