зеркало из https://github.com/mozilla/gecko-dev.git
Created table for nsICommandManager tests, will also be used for nsICommandParams. Updated the ReadMe text to include new build instructions.
a=asa for QA checkins that are not part of the default builds
This commit is contained in:
Родитель
2493903b1d
Коммит
bae32dc86c
|
@ -132,12 +132,14 @@ QAUtils.cpp
|
|||
output data, and retrieving the name of an nsI request are stored
|
||||
here.
|
||||
|
||||
makefile.win
|
||||
makefile.in
|
||||
- We define "_AFXDLL" and for the compiler and specify
|
||||
"-SUBSYSTEM:windows" for the linker using LCFLAGS and
|
||||
LLFLAGS, respectively
|
||||
- We also define "USE_SINGLE_SIGN_ON" to enable the
|
||||
single sign-on support
|
||||
- Also need REQUIRES for all modules to be included
|
||||
- Place all .cpp files for compiling in CPPSRCS section.
|
||||
|
||||
testembed.dsp and testembed.dsw
|
||||
- These VisualStudio workspace/project files can be used
|
||||
|
@ -146,9 +148,26 @@ testembed.dsp and testembed.dsw
|
|||
Instructions for building:
|
||||
1) Open a dos shell.
|
||||
2) cd ../mozilla/embedding/qa/testembed // testEmbed directory
|
||||
3) nmake -f makefile.win // compile testEmbed
|
||||
4) cd ../../../dist/WIN32_D.OBJ/bin/ // navigate to the bin dir
|
||||
5) testembed.exe // run testEmbed.exe
|
||||
3) Copy the makefile.in file and call it makefile. Place in same directory.
|
||||
4) Change the top few lines in 'makefile' to indicate local pathway. Example:
|
||||
DEPTH = ../../..
|
||||
topsrcdir = d:/mozilla_src/mozilla
|
||||
srcdir = d:/mozilla_src/mozilla/embedding/qa/testembed
|
||||
VPATH = d:/mozilla_src/mozilla/embedding/qa/testembed
|
||||
5) cd components // components directory
|
||||
6) Copy the makefile.in file and call it makefile. Place in same directory.
|
||||
7) Change the top few lines in 'makefile' to indicate local pathway. Example:
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = d:/mozilla_src/mozilla
|
||||
srcdir = d:/mozilla_src/mozilla/embedding/qa/testembed/components
|
||||
VPATH = d:/mozilla_src/mozilla/embedding/qa/testembed/components
|
||||
8) make // compile 'makefile.in' in components
|
||||
9) cd .. // return to testembed folder
|
||||
10) make // compile 'makefile.in' in testembed
|
||||
11) cd ../../../dist/bin/ // navigate to the bin dir
|
||||
12) testembed.exe // run testEmbed.exe
|
||||
|
||||
note: if 'make' doesn't work above, try 'make -f makefile.in'
|
||||
|
||||
A few suggestions:
|
||||
1) Don't run nsIWebNavigation tests after turning on the Web
|
||||
|
@ -162,8 +181,5 @@ A few suggestions:
|
|||
That will create a session history. The same applies for the
|
||||
nsIWebNavigation interfaces tests. One loaded url will enable
|
||||
back/forward navigation.
|
||||
4) nsIRequest tests are in progress. They are implemented in
|
||||
BrowserImplWebPrgrsLstnr.cpp. A menu item was created under
|
||||
"Interfaces". This basically does the setup for nsIRequest
|
||||
tests: turns on web progress listener, and prompts user for
|
||||
a url.
|
||||
4) Currently, nsIUriContentListener is registered from the "Tools" >
|
||||
"Test Your Method" menu. That will change soon.
|
||||
|
|
|
@ -133,15 +133,7 @@ void CnsICmdParams::GetStringValueTest(char *stringVal, const char *stateType)
|
|||
if (cmdParamObj) {
|
||||
FormatAndPrintOutput("The input string = ", stringVal, 2);
|
||||
FormatAndPrintOutput("The input state type = ", stateType, 2);
|
||||
/*
|
||||
cmdMgrObj = CnsICommandMgr::GetCommandMgrObject(qaWebBrowser);
|
||||
if (!cmdMgrObj) {
|
||||
QAOutput("We didn't get nsICommandMgr object. Test fails.", 2);
|
||||
return;
|
||||
}
|
||||
else
|
||||
cmdMgrObj->GetCommandState(aCommand, cmdParamObj);
|
||||
*/
|
||||
|
||||
rv = cmdParamObj->SetStringValue(stateType, NS_ConvertASCIItoUCS2(stringVal));
|
||||
rv = cmdParamObj->GetStringValue(stateType, retval);
|
||||
RvTestResult(rv, "GetStringValue test", 2);
|
||||
|
|
|
@ -72,6 +72,59 @@ CnsICommandMgr::~CnsICommandMgr()
|
|||
}
|
||||
|
||||
|
||||
CommandTest CommandTable[] = {
|
||||
{"cmd_bold", "", "state_all", "state_begin", "state_end", "state_mixed", 1},
|
||||
{"cmd_italic", "", "state_all", "state_begin", "state_end", "state_mixed", 1},
|
||||
{"cmd_underline", "", "state_all", "state_begin", "state_end", "state_mixed", 1},
|
||||
{"cmd_indent", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_outdent", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_increaseFont", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_undo", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_redo", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_decreaseFont", "", "", "", "", "", 1},
|
||||
{"cmd_fontColor", "state_attribute", "state_attribute", "", "", "", 1},
|
||||
{"cmd_backgroundColor", "state_attribute", "state_attribute", "", "", "", 1},
|
||||
{"cmd_fontFace", "state_attribute", "state_attribute", "", "", "", 1},
|
||||
{"cmd_align", "state_attribute", "state_attribute", "", "", "", 1},
|
||||
{"cmd_charSet", "state_attribute", "state_attribute", "", "", "", 1},
|
||||
{"cmd_copy", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_delete", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_deleteCharBackward", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_deleteCharForward", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_deleteWordForward", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_deleteWordBackward", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_deleteToBeginningOfLine", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_deleteToEndOfLine", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_scrollTop", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_scrollBottom", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_scrollPageUp", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_scrollPageDown", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_movePageUp", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_movePageDown", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_moveTop", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_moveBottom", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_selectTop", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_selectBottom", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_lineNext", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_linePrevious", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_selectLineNext", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_selectLinePrevious", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_charPrevious", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_charNext", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_selectCharPrevious", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_selectCharNext", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_beginLine", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_endLine", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_selectBeginLine", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_selectEndLine", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_wordPrevious", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_wordNext", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_selectWordPrevious", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_selectWordNext", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_cut", "", "state_enabled", "", "", "", 1},
|
||||
{"cmd_cutOrDelete", "", "state_enabled", "", "", "", 1},
|
||||
};
|
||||
|
||||
nsICommandManager * CnsICommandMgr::GetCommandMgrObject(nsIWebBrowser *aWebBrowser)
|
||||
{
|
||||
nsCOMPtr<nsIWebBrowser> wb(aWebBrowser);
|
||||
|
@ -99,6 +152,11 @@ void CnsICommandMgr::IsCommandSupportedTest(const char *aCommandName)
|
|||
{
|
||||
PRBool isSupported;
|
||||
|
||||
FormatAndPrintOutput("the Command input = ", aCommandName, 2);
|
||||
if (!cmdMgrObj) {
|
||||
QAOutput("Didn't get nsICommandManager object.");
|
||||
return;
|
||||
}
|
||||
cmdMgrObj = GetCommandMgrObject(qaWebBrowser);
|
||||
rv = cmdMgrObj->IsCommandSupported(aCommandName, &isSupported);
|
||||
RvTestResult(rv, "IsCommandSupported() test", 2);
|
||||
|
@ -109,16 +167,22 @@ void CnsICommandMgr::IsCommandEnabledTest(const char *aCommandName)
|
|||
{
|
||||
PRBool isEnabled;
|
||||
|
||||
FormatAndPrintOutput("the Command input = ", aCommandName, 2);
|
||||
cmdMgrObj = GetCommandMgrObject(qaWebBrowser);
|
||||
if (!cmdMgrObj) {
|
||||
QAOutput("Didn't get nsICommandManager object.");
|
||||
return;
|
||||
}
|
||||
rv = cmdMgrObj->IsCommandEnabled(aCommandName, &isEnabled);
|
||||
RvTestResult(rv, "IsCommandEnabled() test", 2);
|
||||
FormatAndPrintOutput("isEnabled boolean = ", isEnabled, 2);
|
||||
}
|
||||
|
||||
void CnsICommandMgr::GetCommandStateTest(const char *aCommandName, const char *stateType)
|
||||
void CnsICommandMgr::GetCommandStateTest(const char *aCommandName)
|
||||
{
|
||||
PRBool enabled = PR_FALSE;
|
||||
|
||||
FormatAndPrintOutput("the Command input = ", aCommandName, 2);
|
||||
cmdMgrObj = GetCommandMgrObject(qaWebBrowser);
|
||||
cmdParamObj = CnsICmdParams::GetCommandParamObject();
|
||||
if (!cmdMgrObj) {
|
||||
|
@ -133,18 +197,32 @@ void CnsICommandMgr::GetCommandStateTest(const char *aCommandName, const char *s
|
|||
rv = cmdMgrObj->GetCommandState(aCommandName, cmdParamObj);
|
||||
RvTestResult(rv, "GetCommandState() test", 2);
|
||||
}
|
||||
// FormatAndPrintOutput("The input state type = ", stateType, 2);
|
||||
// cmdParamObj->GetBooleanValue(stateType, &enabled);
|
||||
// FormatAndPrintOutput("isEnabled boolean = ", enabled, 2);
|
||||
}
|
||||
|
||||
void CnsICommandMgr::DoCommandTest(const char *aCommandName, const char *value)
|
||||
void CnsICommandMgr::DoCommandTest(const char *aCommandName)
|
||||
{
|
||||
nsCAutoString value;
|
||||
|
||||
FormatAndPrintOutput("the Command input = ", aCommandName, 2);
|
||||
cmdMgrObj = GetCommandMgrObject(qaWebBrowser);
|
||||
cmdParamObj = CnsICmdParams::GetCommandParamObject();
|
||||
rv = cmdMgrObj->DoCommand(aCommandName, cmdParamObj);
|
||||
RvTestResult(rv, "DoCommand() test", 2);
|
||||
// cmdParamObj->SetCStringValue("state_attribute", value);
|
||||
if (!cmdMgrObj) {
|
||||
QAOutput("Didn't get nsICommandManager object.");
|
||||
return;
|
||||
}
|
||||
else if (!cmdMgrObj) {
|
||||
QAOutput("Didn't get nsICommandParam object.");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (strcmp(aCommandName,"cmd_fontColor") == 0 ||
|
||||
strcmp(aCommandName,"cmd_backgroundColor") == 0 ||
|
||||
strcmp(aCommandName,"cmd_fontFace") == 0 ||
|
||||
strcmp(aCommandName,"cmd_align") == 0)
|
||||
cmdParamObj->SetCStringValue("state_attribute", value.get());
|
||||
rv = cmdMgrObj->DoCommand(aCommandName, cmdParamObj);
|
||||
RvTestResult(rv, "DoCommand() test", 2);
|
||||
}
|
||||
}
|
||||
|
||||
void CnsICommandMgr::OnStartTests(UINT nMenuID)
|
||||
|
@ -167,18 +245,26 @@ void CnsICommandMgr::OnStartTests(UINT nMenuID)
|
|||
IsCommandEnabledTest("cmd_bold");
|
||||
break;
|
||||
case ID_INTERFACES_NSICOMMANDMANAGER_GETCOMMANDSTATE :
|
||||
GetCommandStateTest("cmd_bold", "state_attribute");
|
||||
GetCommandStateTest("cmd_copy");
|
||||
break;
|
||||
case ID_INTERFACES_NSICOMMANDMANAGER_DOCOMMAND :
|
||||
nsCAutoString value;
|
||||
DoCommandTest("cmd_bold", value.get());
|
||||
DoCommandTest("cmd_fontColor");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CnsICommandMgr::RunAllTests()
|
||||
{
|
||||
QAOutput("Not implemented yet.", 2);
|
||||
PRInt16 i;
|
||||
|
||||
for (i=0; i < 50; i++)
|
||||
{
|
||||
FormatAndPrintOutput("loop cnt = ", i, 2);
|
||||
IsCommandSupportedTest(CommandTable[i].mCmdName);
|
||||
IsCommandEnabledTest(CommandTable[i].mCmdName);
|
||||
GetCommandStateTest(CommandTable[i].mCmdName);
|
||||
DoCommandTest(CommandTable[i].mCmdName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ public:
|
|||
static nsICommandManager * GetCommandMgrWithContractIDObject();
|
||||
void IsCommandSupportedTest(const char *);
|
||||
void IsCommandEnabledTest(const char *);
|
||||
void GetCommandStateTest(const char *, const char *);
|
||||
void DoCommandTest(const char *, const char *);
|
||||
void GetCommandStateTest(const char *);
|
||||
void DoCommandTest(const char *);
|
||||
void OnStartTests(UINT nMenuID);
|
||||
void RunAllTests();
|
||||
// Operations
|
||||
|
@ -94,6 +94,17 @@ protected:
|
|||
|
||||
};
|
||||
|
||||
struct CommandTest
|
||||
{
|
||||
const char *mCmdName;
|
||||
const char *mDoCmdParam;
|
||||
const char *mGetCmdStateParam1;
|
||||
const char *mGetCmdStateParam2;
|
||||
const char *mGetCmdStateParam3;
|
||||
const char *mGetCmdStateParam4;
|
||||
PRBool mGetCmdParamValue;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
|
Загрузка…
Ссылка в новой задаче