----------------------------------------------
License
----------------------------------------------
Copyright (c) 2012 Intel Corporation.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of works must retain the original copyright notice, this list
  of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the original copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
  may be used to endorse or promote products derived from this work without
  specific prior written permission.

THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Authors:
        Lin, Wanming <wanmingx.lin@intel.com>



----------------------------------------------
Introduction
----------------------------------------------
These tests are for checking compliance with HTML5 Web Messaging specification:
http://www.w3.org/TR/2012/CR-webmessaging-20120501


----------------------------------------------
Test Environment
----------------------------------------------
1. Pre-install Testkit-Lite package.
2. Run these cases as "normal" user.


----------------------------------------------
Pre-conditions
----------------------------------------------
1. Make sure the device under testing (DUT) is connected to network.

Note: Chromium does not support loading local files from local browser by default. If you want to load local files, you must add boot argument like 'chromium-browser --allow-file-access-from-files'.

For Test Cases:
                webmessaging_MessageEvent_data_basic.html
                webmessaging_MessageEvent_origin_basic.html
                webmessaging_MessageEvent_ports_basic.html
                webmessaging_MessageEvent_source_basic.html
                webmessaging_window_cross_post_normal_message.html
                webmessaging_window_cross_post_specical_message.html
                webmessaging_MessageEvent_ports_type.html
                webmessaging_MessageEvent_source_type.html
                webmessaging_window_postmessage_message_number.html
                webmessaging_window_postmessage_message_date.html
                webmessaging_window_postmessage_message_ArrayBuffer.html
                webmessaging_window_postmessage_message_FileList.html
                webmessaging_window_postmessage_message_FileBlob.html

Test Steps:
(Note: If you have installed Apache server, you can skip step1.)
   1. Install Apache server:
      open terminal and type in this command: sudo apt-get install apache2;
   2. Create the web project directory:
      open terminal and type in this command: mkdir -p /var/www/opt/tct-webmessaging-w3c-tests/webmessaging;
   3. Properly organize the web resources:
        /opt/tct-webmessaging-w3c-tests/webmessaging/support -->  /var/www/opt/tct-webmessaging-w3c-tests/webmessaging
        /opt/tct-webmessaging-w3c-tests/resources  -->  /var/www/opt/tct-webmessaging-w3c-tests
        The 15 test cases, as previously mentioned -->  /var/www/opt/tct-webmessaging-w3c-tests/webmessaging
   4. Modify tct-webmessaging-w3c-tests/tests.xml to change the est_script_entry node from 'http://127.0.0.1:8080' to 'http://192.168.13.28:8080'(If your IP address is 192.168.13.28);
   5. Restart Apache server:
      open terminal and type in this command: sudo /etc/init.d/apache2 restart;


----------------------------------------------
Build and Run
----------------------------------------------
(Suppose you only get the source code and Testkit-Lite has been set up on your test machine.
 If you have obtained tct-webmessaging-w3c-tests ZIP packages, you can directly go to step 3 on the test machine;
 if you have not installed Testkit-Lite, you need to install the latest version.)

Steps:
1. Prepare for building by running the following command:
   cd tct-webmessaging-w3c-tests

2. Build ZIP package by running the following command:
   ./pack.sh

3. Unzip the package on the test machine by running the following command:
   unzip -o tct-webmessaging-w3c-tests-<version>.zip -d /opt/usr/media/tct

4. Install the package on the test machine by running the following command:
   /opt/usr/media/tct/opt/tct-webmessaging-w3c-tests/inst.sh

5. Run test cases by running the following command on host:
   testkit-lite -f device:/opt/usr/media/tct/opt/tct-webmessaging-w3c-tests/tests.xml -e "WRTLauncher" -o tct-webmessaging-w3c-tests.results.xml
