| Index: chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js
|
| diff --git a/chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js b/chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js
|
| index b2355fe1c88e70cf3a79bb711f167e55be8051f7..127b04858110c53c8b59a78de4e2e3e3cd555b9e 100644
|
| --- a/chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js
|
| +++ b/chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js
|
| @@ -37,6 +37,10 @@ window.runCommand = function(command, opt_step) {
|
| case 'testKeyboardFocusRunNextStep':
|
| testKeyboardFocusRunNextStep(opt_step);
|
| break;
|
| + case 'monitorGuestEvent':
|
| + monitorGuestEvent(opt_step);
|
| + case 'waitGuestEvent':
|
| + waitGuestEvent(opt_step);
|
| default:
|
| embedder.test.fail();
|
| }
|
| @@ -403,7 +407,7 @@ function testBlurEvent() {
|
| // 4) In the second step, the test waits for the input events to be processed
|
| // and then expects the vaue of the <input> to be what the test sent, notably:
|
| // aBc.
|
| -function testKeyboardFocus() {
|
| +function testKeyboardFocusImpl(input_length) {
|
| embedder.testFocus_(function(webview) {
|
| var created = function(e) {
|
| var data = JSON.parse(e.data);
|
| @@ -415,7 +419,7 @@ function testKeyboardFocus() {
|
| window.addEventListener('message', created);
|
|
|
| g_webview = webview;
|
| - var msg = ['request-createInput', 3];
|
| + var msg = ['request-createInput', input_length];
|
| webview.contentWindow.postMessage(JSON.stringify(msg), '*');
|
| }, 'response-elementClicked', function() {
|
| chrome.test.sendMessage('TEST_STEP_PASSED');
|
| @@ -424,9 +428,6 @@ function testKeyboardFocus() {
|
| }
|
|
|
| function testKeyboardFocusRunNextStep(expected) {
|
| - g_webview.contentWindow.postMessage(
|
| - JSON.stringify(['request-getInputValue']), '*');
|
| -
|
| window.addEventListener('message', function(e) {
|
| var data = JSON.parse(e.data);
|
| LOG('send window.message, data: ' + data);
|
| @@ -438,6 +439,17 @@ function testKeyboardFocusRunNextStep(expected) {
|
| }
|
| }
|
| });
|
| +
|
| + g_webview.contentWindow.postMessage(
|
| + JSON.stringify(['request-getInputValue']), '*');
|
| +}
|
| +
|
| +function testKeyboardFocusSimple() {
|
| + testKeyboardFocusImpl(3);
|
| +}
|
| +
|
| +function testKeyboardFocusWindowFocusCycle() {
|
| + testKeyboardFocusImpl(6);
|
| }
|
|
|
| // This test verifies IME related stuff for guest.
|
| @@ -642,6 +654,29 @@ function testAdvanceFocus() {
|
| webview.src = embedder.guestURL;
|
| }
|
|
|
| +function monitorGuestEvent(type) {
|
| + g_webview.contentWindow.postMessage(
|
| + JSON.stringify(['request-monitorEvent', type]), '*');
|
| +}
|
| +
|
| +function waitGuestEvent(type) {
|
| + var listener = function(e) {
|
| + var data = JSON.parse(e.data);
|
| + if (data[0] == 'response-waitEvent') {
|
| + window.removeEventListener('message', listener);
|
| + if (data[1] == type) {
|
| + chrome.test.sendMessage('TEST_STEP_PASSED');
|
| + } else {
|
| + chrome.test.sendMessage('TEST_STEP_FAILED');
|
| + }
|
| + }
|
| + }
|
| + window.addEventListener('message', listener);
|
| +
|
| + g_webview.contentWindow.postMessage(
|
| + JSON.stringify(['request-waitEvent', type]), '*');
|
| +}
|
| +
|
| embedder.test.testList = {
|
| 'testAdvanceFocus': testAdvanceFocus,
|
| 'testBlurEvent': testBlurEvent,
|
| @@ -649,7 +684,8 @@ embedder.test.testList = {
|
| 'testFocusEvent': testFocusEvent,
|
| 'testFocusTracksEmbedder': testFocusTracksEmbedder,
|
| 'testInputMethod': testInputMethod,
|
| - 'testKeyboardFocus': testKeyboardFocus,
|
| + 'testKeyboardFocusSimple': testKeyboardFocusSimple,
|
| + 'testKeyboardFocusWindowFocusCycle': testKeyboardFocusWindowFocusCycle,
|
| 'testFocusRestored': testFocusRestored
|
| };
|
|
|
|
|