Commit 8d2d9254 authored by joaodasilva's avatar joaodasilva Committed by Commit bot

Fixed flakyness of PolicyTest.FileURLBlacklist.

The problem was introduced in https://codereview.chromium.org/110643005.
The URLBlacklistManager used to build the blacklist in the FILE thread
but it's now using the blocking pool; however, FlushBlacklistPolicy
wasn't updated to flush the blocking pool instead of the FILE thread.

This test (and the URL blacklist tests too) have been flaking now
and then on every bot but this race is extremely hard to trigger.
DrMemory on Windows was a consistent repro though.

BUG=339240

Review URL: https://codereview.chromium.org/520703002

Cr-Commit-Position: refs/heads/master@{#292874}
parent 8cba4967
......@@ -23,6 +23,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/test_file_util.h"
#include "base/threading/sequenced_worker_pool.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/app/chrome_command_ids.h"
......@@ -293,7 +294,9 @@ void CheckCanOpenURL(Browser* browser, const char* spec) {
content::WebContents* contents =
browser->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(url, contents->GetURL());
base::string16 title = base::UTF8ToUTF16(url.spec() + " was blocked");
base::string16 spec16 = base::UTF8ToUTF16(url.spec());
base::string16 title =
l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_BLOCKED, spec16);
EXPECT_NE(title, contents->GetTitle());
}
......@@ -304,7 +307,9 @@ void CheckURLIsBlocked(Browser* browser, const char* spec) {
content::WebContents* contents =
browser->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(url, contents->GetURL());
base::string16 title = base::UTF8ToUTF16(url.spec() + " was blocked");
base::string16 spec16 = base::UTF8ToUTF16(url.spec());
base::string16 title =
l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_BLOCKED, spec16);
EXPECT_EQ(title, contents->GetTitle());
// Verify that the expected error page is being displayed.
......@@ -452,9 +457,9 @@ int CountPlugins() {
void FlushBlacklistPolicy() {
// Updates of the URLBlacklist are done on IO, after building the blacklist
// on FILE, which is initiated from IO.
// on the blocking pool, which is initiated from IO.
content::RunAllPendingInMessageLoop(BrowserThread::IO);
content::RunAllPendingInMessageLoop(BrowserThread::FILE);
BrowserThread::GetBlockingPool()->FlushForTesting();
content::RunAllPendingInMessageLoop(BrowserThread::IO);
}
......
......@@ -19,6 +19,3 @@ SSLUITest.TestBadFrameNavigation
SSLUITest.TestInterstitialJavaScriptProceeds
SSLUITest.TestRefNavigation
SSLUITest.TestWSSInvalidCertAndGoForward
# http://crbug.com/339240
PolicyTest.FileURLBlacklist
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