Index: chrome_frame/test/data/context_menu.html |
=================================================================== |
--- chrome_frame/test/data/context_menu.html (revision 0) |
+++ chrome_frame/test/data/context_menu.html (revision 0) |
@@ -0,0 +1,65 @@ |
+<html> |
+ <head> |
+ <meta http-equiv="x-ua-compatible" content="chrome=1" /> |
+ <script type="text/javascript" src="chrome_frame_tester_helpers.js"> |
+ </script> |
+ <script> |
+ // Default text value used to test cut/copy/paste etc. |
+ var INIT_VAL = "SomeInitializedTextValue"; |
+ |
+ // Get selected text value in text field. |
+ function getSelectionInTextField(id) { |
+ var textField = document.getElementById(id); |
+ var selectedValue = textField.value.substring(textField.selectionStart, |
+ textField.selectionEnd); |
+ return selectedValue; |
+ } |
+ |
+ function isExpectedResult(action) { |
+ var txtFieldVal = document.getElementById("textField").value; |
+ var res = false; |
+ |
+ switch (action) { |
+ case "selectall": |
+ if (getSelectionInTextField("textField") == INIT_VAL) { |
+ res = true; |
+ } else { |
+ res = false; |
+ } |
+ break; |
+ } |
+ return res; |
+ } |
+ |
+ // Verify the expected result based on action and post message to host. |
+ function verifyTextFieldContents(event) { |
kkania
2010/11/09 22:45:21
Now that we only have one action, let's simplify t
|
+ var action = event.data; |
+ |
+ if (isExpectedResult(action)) { |
+ window.externalHost.postMessage("OK"); |
+ } else { |
+ window.externalHost.postMessage("Fail"); |
+ } |
+ } |
+ |
+ // Do some initialization work like setting text field value, |
+ // and selecting the value by default before the test starts. |
+ function init() { |
+ var action = getURLParameter("action"); |
+ |
+ document.getElementById("textField").value = INIT_VAL; |
+ document.getElementById("textField").focus(); |
+ if (action != "selectall") { |
+ document.getElementById("textField").select(); |
+ } |
+ |
+ window.externalHost.onmessage = verifyTextFieldContents; |
+ } |
+ </script> |
+ </head> |
+ |
+ <body leftmargin="0" topmargin="0" onload="init()"> |
+ <input type="text" name="textField" id="textField" size="25" value=""></td> |
+ </body> |
+</html> |
+ |
Property changes on: chrome_frame\test\data\context_menu.html |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |