X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fchrome%2Fbrowser%2Fresources%2Fchromeos%2Fchromevox%2Ftesting%2Fchromevox_e2e_test_base.js;h=4728104eed0b9a574741b0c36acbebe4a155a7ee;hb=1afa4dd80ef85af7c90efaea6959db1d92330844;hp=bef9ee783bc42a227c191bbf878f0d56420e75a3;hpb=90762837333c13ccf56f2ad88e4481fc71e8d281;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/chrome/browser/resources/chromeos/chromevox/testing/chromevox_e2e_test_base.js b/src/chrome/browser/resources/chromeos/chromevox/testing/chromevox_e2e_test_base.js index bef9ee7..4728104 100644 --- a/src/chrome/browser/resources/chromeos/chromevox/testing/chromevox_e2e_test_base.js +++ b/src/chrome/browser/resources/chromeos/chromevox/testing/chromevox_e2e_test_base.js @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +GEN_INCLUDE([ + 'chrome/browser/resources/chromeos/chromevox/testing/common.js']); + /** * Base test fixture for ChromeVox end to end tests. * @@ -42,16 +45,39 @@ ChromeVoxE2ETest.prototype = { GEN_BLOCK(function() {/*! if (chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled()) { chromeos::AccessibilityManager::Get()->EnableSpokenFeedback(false, - ash::A11Y_NOTIFICATION_NONE); + ui::A11Y_NOTIFICATION_NONE); } base::Closure load_cb = base::Bind(&chromeos::AccessibilityManager::EnableSpokenFeedback, base::Unretained(chromeos::AccessibilityManager::Get()), true, - ash::A11Y_NOTIFICATION_NONE); + ui::A11Y_NOTIFICATION_NONE); WaitForExtension(extension_misc::kChromeVoxExtensionId, load_cb); */}); + }, + + /** + * Run a test with the specified HTML snippet loaded. + * @param {function() : void} doc Snippet wrapped inside of a function. + * @param {function()} callback Called once the document is ready. + */ + runWithDocument: function(doc, callback) { + var docString = TestUtils.extractHtmlFromCommentEncodedString(doc); + var url = 'data:text/html,' + + docString + + ''; + var createParams = { + active: true, + url: url + }; + chrome.tabs.create(createParams, function(tab) { + chrome.tabs.onUpdated.addListener(function(tabId, changeInfo) { + if (tabId == tab.id && changeInfo.status == 'complete') { + callback(); + } + }); + }); } };