зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1523483
, bug 1522280) for xpcshell failures on test_UrlbarController_unit.js
Backed out changeset 2859bb1963a1 (bug 1522280)
Backed out changeset 0aaeb345e02c (bug 1523483
)
This commit is contained in:
Родитель
0dea5b5f2c
Коммит
596e337c2d
|
@ -135,12 +135,12 @@ class UrlbarController {
|
|||
TelemetryStopwatch.finish(TELEMETRY_6_FIRST_RESULTS, queryContext);
|
||||
}
|
||||
|
||||
if (queryContext.lastResultCount == 0 && queryContext.autofillValue) {
|
||||
this.input.autofill(queryContext.autofillValue);
|
||||
}
|
||||
|
||||
// The first time we receive results try to connect to the heuristic result.
|
||||
if (queryContext.lastResultCount == 0) {
|
||||
if (queryContext.autofillValue) {
|
||||
this.input.autofill(queryContext.autofillValue);
|
||||
}
|
||||
// The first time we receive results try to connect to the heuristic
|
||||
// result.
|
||||
this.speculativeConnect(queryContext, 0, "resultsadded");
|
||||
}
|
||||
|
||||
|
|
|
@ -206,44 +206,15 @@ add_task(function test_receiveResults() {
|
|||
sandbox.resetHistory();
|
||||
});
|
||||
|
||||
add_task(async function test_autofillValue() {
|
||||
// Ensure the controller doesn't have any previous queries.
|
||||
delete controller._lastQueryContext;
|
||||
|
||||
// Stub the controller's input so we can tell whether input.autofill() is
|
||||
// called.
|
||||
let input = {
|
||||
autofill: sandbox.stub(),
|
||||
};
|
||||
controller.input = input;
|
||||
|
||||
add_task(function test_autocomplete_enabled() {
|
||||
const context = createContext();
|
||||
controller.startQuery(context);
|
||||
|
||||
// Set autofillValue and call receiveResults().
|
||||
context.autofillValue = "test";
|
||||
context.results = [
|
||||
new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
{ url: "http://example.com/1" }),
|
||||
];
|
||||
context.results = [];
|
||||
controller.receiveResults(context);
|
||||
|
||||
Assert.equal(input.autofill.callCount, 1,
|
||||
"Should have called input.autofill() one time");
|
||||
Assert.deepEqual(input.autofill.args[0], ["test"],
|
||||
"Should have called input.autofill() with context.autofillValue");
|
||||
|
||||
// Call receiveResults() again with more results.
|
||||
context.results.push(
|
||||
new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
{ url: "http://example.com/2" }),
|
||||
);
|
||||
controller.receiveResults(context);
|
||||
|
||||
Assert.equal(input.autofill.callCount, 1,
|
||||
"Should not have called input.autofill() again");
|
||||
Assert.equal(generalListener.onQueryResults.callCount, 1,
|
||||
"Should have called onQueryResults for the listener");
|
||||
Assert.deepEqual(generalListener.onQueryResults.args[0], [context],
|
||||
"Should have called onQueryResults with the context");
|
||||
|
||||
sandbox.resetHistory();
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче