Commit c7b65a10 authored by David Bertoni's avatar David Bertoni Committed by Commit Bot

[Extensions] Re-enabled some tests that are no longer flaky.

The HistoryApiTest.MiscSearch and HistoryApiTest.TimedSearch
tests are no longer flaky. This CL also removes an obsolete
test and some broken retry code that is not exercised.

Bug: 119505
Change-Id: I21640126da76c61a23558f89c6728f41e1a34fac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2147681Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758976}
parent aaf2693e
......@@ -41,15 +41,13 @@ class HistoryApiTest : public ExtensionApiTest {
}
};
// Full text search indexing sometimes exceeds a timeout. (http://crbug/119505)
IN_PROC_BROWSER_TEST_F(HistoryApiTest, DISABLED_MiscSearch) {
IN_PROC_BROWSER_TEST_F(HistoryApiTest, MiscSearch) {
ASSERT_TRUE(StartEmbeddedTestServer());
ASSERT_TRUE(RunExtensionSubtest("history/regular", "misc_search.html"))
<< message_;
}
// Same could happen here without the FTS (http://crbug/119505)
IN_PROC_BROWSER_TEST_F(HistoryApiTest, DISABLED_TimedSearch) {
IN_PROC_BROWSER_TEST_F(HistoryApiTest, TimedSearch) {
ASSERT_TRUE(StartEmbeddedTestServer());
ASSERT_TRUE(RunExtensionSubtest("history/regular", "timed_search.html"))
<< message_;
......
......@@ -7,10 +7,6 @@
var PROHIBITED_ERR = "Browsing history is not allowed to be deleted.";
// The maximum number of tries querying the history database to make sure that
// the initial addUrl calls succeeded.
var MAX_HISTORY_TRIES = 10;
function deleteProhibitedTestVerification() {
removeItemRemovedListener();
chrome.test.fail("Delete was prohibited, but succeeded anyway.");
......@@ -46,15 +42,9 @@ function verifyNoDeletion(testFunction) {
var query = { 'text': '' };
chrome.history.addUrl({ url: GOOGLE_URL }, pass(function() {
chrome.history.addUrl({ url: PICASA_URL }, pass(function() {
// Humans use 1-based counting.
var tries = 1;
chrome.history.search(query, pass(function lambda(resultsBefore) {
if (verifyHistory(resultsBefore)) {
// Success: proceed with the test.
if (tries > 1) {
console.log("Warning: Added URLs took " + tries + " tries to " +
"show up in history. See http://crbug.com/176828.");
}
testFunction(fail(PROHIBITED_ERR, function() {
chrome.history.search(query, pass(function(resultsAfter) {
assertEq(resultsBefore.sort(sortResults),
......@@ -62,14 +52,7 @@ function verifyNoDeletion(testFunction) {
removeItemRemovedListener();
}));
}));
} else if (tries < MAX_HISTORY_TRIES) {
// Results not yet in history: try again. See http://crbug.com/176828.
++tries;
waitAFewSeconds(0.1, pass(function() {
chrome.history.search(query, pass(lambda));
}));
} else {
// Too many tries: fail.
chrome.test.fail("Added URLs never showed up in the history. " +
"See http://crbug.com/176828.");
}
......
......@@ -56,66 +56,4 @@ runHistoryTestFns([
populateHistory(urls, function() { });
});
},
function fullTextSearch() {
chrome.history.deleteAll(function() {
// The continuation of the test after the windows have been opened.
var validateTest = function() {
// Continue with the test.
// A title search for www.a.com should find a.
var query = { 'text': 'www.a.com' };
chrome.history.search(query, function(results) {
assertEq(1, results.length);
assertEq(A_RELATIVE_URL, results[0].url);
// Text in the body of b.html.
query = { 'text': 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' };
chrome.history.search(query, function(results) {
assertEq(1, results.length);
assertEq(B_RELATIVE_URL, results[0].url);
// The test has succeeded.
chrome.test.succeed();
});
});
};
// Setup a callback object for tab events.
var urls = [A_RELATIVE_URL, B_RELATIVE_URL];
var tabIds = [];
function listenerCallback() {
if (tabIds.length < urls.length) {
return;
}
// Ensure both tabs have completed loading.
for (var index = 0, id; id = tabIds[index]; index++) {
if (!tabsCompleteData[id] ||
tabsCompleteData[id] != 'complete') {
return;
};
}
// Unhook callbacks.
tabCompleteCallback = null;
chrome.tabs.onUpdated.removeListener(tabsCompleteListener);
// Allow indexing to occur.
waitAFewSeconds(3, function() {
validateTest();
});
}
tabCompleteCallback = listenerCallback;
chrome.tabs.onUpdated.addListener(tabsCompleteListener);
// Navigate to a few pages.
urls.forEach(function(url) {
chrome.tabs.create({ 'url': url }, function(tab) {
tabIds.push(tab.id);
});
});
});
}
]);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment