Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1628)

Unified Diff: chrome/browser/download/download_uitest.cc

Issue 209033: Fix coverity issue found in flaky DownloadTest, which should also decrease flakiness. (Closed)
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_uitest.cc
diff --git a/chrome/browser/download/download_uitest.cc b/chrome/browser/download/download_uitest.cc
index 915fc88c4cdac4e3a96e70c8589ff92e0897cba9..3c134fd0c56c71636f2ff41c7f847da354b85c9e 100644
--- a/chrome/browser/download/download_uitest.cc
+++ b/chrome/browser/download/download_uitest.cc
@@ -133,14 +133,7 @@ class DownloadTest : public UITest {
#if defined(OS_WIN)
// Checks if the ZoneIdentifier is correctly set to "Internet" (3)
void CheckZoneIdentifier(const std::wstring full_path) {
- const DWORD kShare = FILE_SHARE_READ |
- FILE_SHARE_WRITE |
- FILE_SHARE_DELETE;
-
std::wstring path = full_path + L":Zone.Identifier";
- HANDLE file = CreateFile(path.c_str(), GENERIC_READ, kShare, NULL,
- OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- ASSERT_TRUE(INVALID_HANDLE_VALUE != file);
// This polling and sleeping here is a very bad pattern. But due to how
// Windows file semantics work it's really hard to do it other way. We are
@@ -150,6 +143,14 @@ class DownloadTest : public UITest {
for (int i = 0; i < 20; i++) {
PlatformThread::Sleep(sleep_timeout_ms());
+ const DWORD kShare = FILE_SHARE_READ |
+ FILE_SHARE_WRITE |
+ FILE_SHARE_DELETE;
+ HANDLE file = CreateFile(path.c_str(), GENERIC_READ, kShare, NULL,
+ OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (file == INVALID_HANDLE_VALUE)
+ continue;
+
char buffer[100] = {0};
DWORD read = 0;
BOOL read_result = ReadFile(file, buffer, 100, &read, NULL);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698