modules/oji/tests/README
author Anoop Saldanha (Poona) <poonaatsoc@gmail.com>
Sun, 27 Jul 2008 14:40:15 -0400
changeset 16251 bd0013e0d3af993f88b84fc219b50ec66ed6fa61
parent 1 9b2a99adc05e53cd4010de512f50118594756650
permissions -rwxr-xr-x
Bug 445021 - Add more functions in DM's utils.js for chrome tests. This adds a number of common functions to the utils.js file used by the download manager chrome tests. r=sdwilsh

This README file indicates steps required for Building and Execution of OJI API tests 

How the Tests Work
------------------
 These OJI API Tests basically 4 areas via:
    Java Native Interface     (JNI)
    JVM Manager Tests         (JM)
    Thread Manager Tests      (TM)
    LiveConnect Manager Tests (LCM)

 On Building the Test Base ( from build directory) 5 shared libraries are 
 created which are copied over to the bin/components dir. 
 (  libojiapijmtests.so,libojiapilcmtests.so, libojiapitmtests.so,
    libojiapijnitests.so, libojiapitl.so )

 On Invoking the browser, it registers all these libraries and then invokes
 the page test.html (in script dir.)
 
 It first prompts a dialog box for Permissions to invoke a XPConnect call.
 The user has to grant permissions to execute the tests. 
 (NOTE: If user denys, then the tests cannot be invoked) 

 Once permissions are granted, it will follow these steps
    *  Create a TestLoader  instance.
    *  Read List of Tests from file OJITestsList.lst (in script dir.)
    *  For each test entry in that file, determine type of Test (JNI/JM/LCM/TM)
    *  Load appropriate library if not already loaded
    *  Find method address from the loaded library
    *  Invoke method to be tested with appropriate test parameters
    *  Record results in log file

Below are instructions on how to build and execute.
Also check FAQ for answers to known problems encountered.

-------------------------------------------------------------------------------

Instructions (Build/Execution)
==============================

Win32
-----

============-=============
I. Build OJI API test:
==========================

 Pre-Requisite: You must have built mozilla browser and 
                have Perl (version >= 5) installed.

 1. set MOZILLA_HOME (top of Mozilla's tree) and JAVAHOME variables
 2. set MOZILLA_FIVE_HOME  to <MOZILLA_HOME>/dist/win32_O.obj/bin directory
    where mozilla.exe is located
 3. goto build directory and say
        nmake -f Makefile.win

 Libraries created are located in 'build/bin' dir. and 
 MOZILLA_FIVE_HOME/components directory.

=============================
II.Execute  OJI API tests:
=============================

 Pre-Requisite: Have Perl  (version >= 5) installed and 
                Java1.3.0_01 SDK installed.

 1. Update <homedir>/Program Files/Users50/<profile dir>/prefs.js to add line
         user_pref("signed.applets.codebase_principal_support",true);
    where <profile dir> is your profile name
 2. Update Path variable to include 
         $MOZILLA_HOME/dist/win32_O.obj/bin and
         $MOZILLA_HOME/dist/win32_O.obj/bin/components
 3. Set TEST_URL to point to url location of test.html.
    (file://<mozilla dir>/modules/oji/tests/script)
 4. Delete component.reg file in Mozilla's bin directory.
 5. Click on Start-Settings-Control Panel->Duke icon.
    This will invoke the Java Plugin Control Panel
 6. In Runtime Parameter Text Field add the following line
       -Xbootclasspath/a:<class dir>
    where <class dir> is <MOZILLA_HOME>\modules\oji\tests\build\classes
 7. Create .java.policy file in you home directory and add this line 
     grant {
         permission java.security.AllPermission;
     }
 8. Change DELAY_FACTOR in script/autorun.pl to some higher value, if mozilla
    takes more time to load. It should be a value greater than 0.
 9  Change script/autorun.pl and change ADDITIONAL_PARAMETERS  to reflect your
    profile
10. Goto script dir. and run perl script
       perl autorun.pl
11. It will invoke the browser and load 'test.html'.
12. It should prompt a "Internet Security" Dialog box prompting for Permissions
    Check "Remember the decision" checkbox.
    Click on 'Yes' (NOTE: clicking on 'No' will not invoke any of the Tests).

All done
 See results of execution in the script/log directory.
 Output HTML file is script/log/BWTest.html



--------------------------------------------------------------------------
Solaris/Linux
--------------

==========================
I. Build OJI API test:
==========================

 Pre-Requisite: You must have built mozilla browser and have 
                have Perl (version >= 5) installed.

 1. set MOZILLA_HOME (top of Mozilla's tree) and JAVAHOME variables
 2. set MOZILLA_FIVE_HOME to <MOZILLA_HOME>/dist/bin
    where mozilla-bin is located
 3. set CC to point to gcc
       setenv CC gcc
 4. goto build directory and say
          gmake

 Libraries created are located in 'build/bin' dir. and 
 MOZILLA_FIVE_HOME/components directory.

=============================
II. Execute OJI API tests:
=============================

 Pre-Requisite: Have Perl installed and Java2 SDK installed.

 1. Update <home dir>/.mozilla/<profile dir>/prefs.js to add line
        user_pref("signed.applets.codebase_principal_support",true);
    where <profile dir> is your profile name
 2. Update LD_LIBRARY_PATH variable to include 
        $MOZILLA_HOME/dist/bin and
        $MOZILLA_HOME/dist/bin/components
 3. Set TEST_URL to point to url location of test.html.
    (file://<mozilla dir>/modules/oji/tests/script)
 4. Delete component.reg file in Mozilla's bin directory.
 5. Invoke <Java2 SDK dir.>/jre/bin/ControlPanel
 6. In RunTime Parameter Text Field add the following line
       -Xbootclasspath/a:<class dir>
    where <class dir> is <MOZILLA_HOME>/modules/oji/tests/build/classes
      
 7. Create .java.policy file in you home directory and add the lines
     grant {
         permission java.security.AllPermission;
     }
 8. Change DELAY_FACTOR in script/autorun.pl to some higher value, if mozilla
    takes more time to load. It should be a value greater than 0.
 9  Change script/autorun.pl and change ADDITIONAL_PARAMETERS  to reflect your
    profile (by default it uses default).
10. Goto script dir. and run perl script
          perl autorun.pl
11. It will invoke the browser and load 'test.html'.
12. It should prompt a "Internet Security" Dialog box prompting for Permissions
    Check "Remember the decision" checkbox.
    Click on 'Yes' (NOTE: clicking on 'No' will not invoke any of the Tests).


All done
 See results of execution in the script/log directory.
 Output HTML file is script/log/BWTest.html


--------------------------------------------------------------------------
Mac
---

 Currently does not work with Mac.