Backed out changeset 9ac001517068 (bug 1045053)

This commit is contained in:
Carsten "Tomcat" Book 2014-10-02 10:29:18 +02:00
parent 18562435cf
commit 2b1ad4f716
5 changed files with 2 additions and 134 deletions

View File

@ -82,16 +82,6 @@ abstract class BaseTest extends BaseRobocopTest {
protected int mScreenMidHeight;
private final HashSet<Integer> mKnownTabIDs = new HashSet<Integer>();
protected void blockForDelayedStartup() {
try {
Actions.EventExpecter delayedStartupExpector = mActions.expectGeckoEvent("Gecko:DelayedStartup");
delayedStartupExpector.blockForEvent(GECKO_READY_WAIT_MS, true);
delayedStartupExpector.unregisterListener();
} catch (Exception e) {
mAsserter.dumpLog("Exception in blockForDelayedStartup", e);
}
}
protected void blockForGeckoReady() {
try {
Actions.EventExpecter geckoReadyExpector = mActions.expectGeckoEvent("Gecko:Ready");

View File

@ -21,14 +21,11 @@ public class JavascriptTest extends BaseTest {
public void testJavascript() throws Exception {
blockForGeckoReady();
doTestJavascript();
}
protected void doTestJavascript() throws Exception {
// We want to be waiting for Robocop messages before the page is loaded
// because the test harness runs each test in the suite (and possibly
// completes testing) before the page load event is fired.
final Actions.EventExpecter expecter = mActions.expectGeckoEvent(EVENT_TYPE);
final Actions.EventExpecter expecter =
mActions.expectGeckoEvent(EVENT_TYPE);
mAsserter.dumpLog("Registered listener for " + EVENT_TYPE);
final String url = getAbsoluteUrl(StringHelper.getHarnessUrlForJavascript(javascriptUrl));

View File

@ -104,7 +104,6 @@ skip-if = android_version == "10"
[testJNI]
# [testMozPay] # see bug 945675
[testOrderedBroadcast]
[testOSLocale]
[testResourceSubstitutions]
[testRestrictedProfiles]
[testSharedPreferences]

View File

@ -1,25 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.tests;
import org.mozilla.gecko.Actions;
public class testOSLocale extends JavascriptTest {
private static final String GECKO_DELAYED_STARTUP = "Gecko:DelayedStartup";
public testOSLocale() {
super("testOSLocale.js");
}
@Override
public void testJavascript() throws Exception {
final Actions.EventExpecter expecter = mActions.expectGeckoEvent(GECKO_DELAYED_STARTUP);
expecter.blockForEvent(MAX_WAIT_MS, true);
// We wait for Gecko:DelayedStartup above, so we *must not* wait for Gecko:Ready.
// Call doTestJavascript directly.
super.doTestJavascript();
}
}

View File

@ -1,93 +0,0 @@
// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
const { utils: Cu, interfaces: Ci } = Components;
Cu.import("resource://gre/modules/Services.jsm");
/**
* If we ever start running tests with a different default OS locale,
* this test will break.
*/
function getOSLocale() {
try {
return Services.prefs.getCharPref("intl.locale.os");
} catch (ex) {
return null;
}
}
function getAcceptLanguages() {
return Services.prefs.getComplexValue("intl.accept_languages",
Ci.nsIPrefLocalizedString).data;
}
/**
* Ensure that by the time we come to run, the OS locale
* has been sent over the wire and persisted in prefs.
*/
add_test(function test_OSLocale() {
let osObserver = function () {
Services.prefs.removeObserver("intl.locale.os", osObserver);
do_check_eq(getOSLocale(), "en-US");
run_next_test();
};
let osLocale = getOSLocale();
if (osLocale) {
// Proceed with the test.
run_next_test();
return;
}
// Otherwise, wait for it. We're probably running before the message has
// been handled.
Services.prefs.addObserver("intl.locale.os", osObserver, false);
});
add_test(function test_AcceptLanguages() {
// Fake that we have an app locale, and fake
// a different OS locale to make it interesting.
// The correct set here depends on whether the
// browser was built with multiple locales or not.
// This is exasperating, but hey.
// Expected, from es-ES's intl.properties:
const ES_ES_EXPECTED_BASE = "es-ES,es,en-US,en";
// Expected, from en-US (the default).
const MONO_EXPECTED_BASE = "en-US,en";
// This will always be the same: it's deduced from our language setting and
// the fake OS.
const SELECTED_LOCALES = "es-es,fr,";
// And so the two expected results:
const ES_ES_EXPECTED = SELECTED_LOCALES +
"es,en-us,en"; // Remainder of ES_ES_EXPECTED_BASE.
const MONO_EXPECTED = SELECTED_LOCALES +
"en-us,en"; // Remainder of MONO_EXPECTED_BASE.
let observer = function () {
Services.prefs.removeObserver("intl.accept_languages", observer);
// And so intl.accept_languages should be one of these two...
let acc = getAcceptLanguages();
let is_es = ES_ES_EXPECTED == acc;
let is_en = MONO_EXPECTED == acc;
do_check_true(is_es || is_en);
do_check_true(is_es != is_en);
run_next_test();
};
Services.prefs.setCharPref("intl.locale.os", "fr");
Services.prefs.addObserver("intl.accept_languages", observer, false);
Services.obs.notifyObservers(null, "Locale:Changed", "es-ES");
});
run_next_test();