Commit c95227e1 authored by David Black's avatar David Black Committed by Commit Bot

Re-enable previously flaky ClipboardHistory browser test.

Flakes were due to race condition in restoring clipboard buffer. This
doesn't solve the issue that we still have a race condition, but should
make the race condition less flaky.

Bug: 1116530
Change-Id: Id0683fc408d48ed6daf795d5ab80ac1095c033d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2360222Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: David Black <dmblack@google.com>
Cr-Commit-Position: refs/heads/master@{#798799}
parent 576e6d26
...@@ -240,7 +240,7 @@ void ClipboardHistoryController::MenuOptionSelected(int index, ...@@ -240,7 +240,7 @@ void ClipboardHistoryController::MenuOptionSelected(int index,
// Replace the original item back on top of the clipboard. Some apps take a // Replace the original item back on top of the clipboard. Some apps take a
// long time to receive the paste event, also some apps will read from the // long time to receive the paste event, also some apps will read from the
// clipboard multiple times per paste. Wait 100ms before replacing the item // clipboard multiple times per paste. Wait a bit before replacing the item
// back onto the clipboard. // back onto the clipboard.
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, FROM_HERE,
...@@ -259,7 +259,7 @@ void ClipboardHistoryController::MenuOptionSelected(int index, ...@@ -259,7 +259,7 @@ void ClipboardHistoryController::MenuOptionSelected(int index,
GetClipboard()->WriteClipboardData(std::move(original_data)); GetClipboard()->WriteClipboardData(std::move(original_data));
}, },
weak_ptr_factory_.GetWeakPtr(), std::move(original_data)), weak_ptr_factory_.GetWeakPtr(), std::move(original_data)),
base::TimeDelta::FromMilliseconds(100)); base::TimeDelta::FromMilliseconds(200));
} }
gfx::Rect ClipboardHistoryController::CalculateAnchorRect() const { gfx::Rect ClipboardHistoryController::CalculateAnchorRect() const {
......
...@@ -352,9 +352,8 @@ IN_PROC_BROWSER_TEST_F(ClipboardHistoryWithMultiProfileBrowserTest, ...@@ -352,9 +352,8 @@ IN_PROC_BROWSER_TEST_F(ClipboardHistoryWithMultiProfileBrowserTest,
Release(ui::KeyboardCode::VKEY_COMMAND); Release(ui::KeyboardCode::VKEY_COMMAND);
} }
// Disabled for being flaky. crbug.com/1116530
IN_PROC_BROWSER_TEST_F(ClipboardHistoryWithMultiProfileBrowserTest, IN_PROC_BROWSER_TEST_F(ClipboardHistoryWithMultiProfileBrowserTest,
DISABLED_ShouldPasteHistoryAsPlainText) { ShouldPasteHistoryAsPlainText) {
LoginUser(account_id1_); LoginUser(account_id1_);
// Create a browser and cache its active web contents. // Create a browser and cache its active web contents.
...@@ -382,10 +381,9 @@ IN_PROC_BROWSER_TEST_F(ClipboardHistoryWithMultiProfileBrowserTest, ...@@ -382,10 +381,9 @@ IN_PROC_BROWSER_TEST_F(ClipboardHistoryWithMultiProfileBrowserTest,
e.preventDefault(); e.preventDefault();
const clipboardData = e.clipboardData || window.clipboardData; const clipboardData = e.clipboardData || window.clipboardData;
lastPaste = clipboardData.types.reduce((data, type) => { lastPaste = clipboardData.types.map((type) => {
data.push(`${type}: ${clipboardData.getData(type)}`); return `${type}: ${clipboardData.getData(type)}`;
return data; });
}, []);
document.title = `Paste ${lastPasteId++}`; document.title = `Paste ${lastPasteId++}`;
}); });
......
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