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

Side by Side Diff: chrome/browser/download/download_uitest.cc

Issue 203033: Increase number of tries in CheckInternetZoneIdentifier. (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <sstream> 5 #include <sstream>
6 #include <string> 6 #include <string>
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <shlwapi.h> 10 #include <shlwapi.h>
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 std::wstring path = full_path + L":Zone.Identifier"; 140 std::wstring path = full_path + L":Zone.Identifier";
141 HANDLE file = CreateFile(path.c_str(), GENERIC_READ, kShare, NULL, 141 HANDLE file = CreateFile(path.c_str(), GENERIC_READ, kShare, NULL,
142 OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); 142 OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
143 ASSERT_TRUE(INVALID_HANDLE_VALUE != file); 143 ASSERT_TRUE(INVALID_HANDLE_VALUE != file);
144 144
145 // This polling and sleeping here is a very bad pattern. But due to how 145 // This polling and sleeping here is a very bad pattern. But due to how
146 // Windows file semantics work it's really hard to do it other way. We are 146 // Windows file semantics work it's really hard to do it other way. We are
147 // reading a file written by a different process, using a different handle. 147 // reading a file written by a different process, using a different handle.
148 // Windows does not guarantee that we will get the same contents even after 148 // Windows does not guarantee that we will get the same contents even after
149 // the other process closes the handle, flushes the buffers, etc. 149 // the other process closes the handle, flushes the buffers, etc.
150 for (int i = 0; i < 10; i++) { 150 for (int i = 0; i < 20; i++) {
151 PlatformThread::Sleep(sleep_timeout_ms()); 151 PlatformThread::Sleep(sleep_timeout_ms());
152 152
153 char buffer[100] = {0}; 153 char buffer[100] = {0};
154 DWORD read = 0; 154 DWORD read = 0;
155 BOOL read_result = ReadFile(file, buffer, 100, &read, NULL); 155 BOOL read_result = ReadFile(file, buffer, 100, &read, NULL);
156 CloseHandle(file); 156 CloseHandle(file);
157 157
158 if (!read_result) 158 if (!read_result)
159 continue; 159 continue;
160 160
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 ASSERT_EQ(1, window_count); 347 ASSERT_EQ(1, window_count);
348 348
349 // Verify that the regular window does not have a download shelf. 349 // Verify that the regular window does not have a download shelf.
350 browser->IsShelfVisible(&is_shelf_visible); 350 browser->IsShelfVisible(&is_shelf_visible);
351 EXPECT_FALSE(is_shelf_visible); 351 EXPECT_FALSE(is_shelf_visible);
352 352
353 CleanUpDownload(file); 353 CleanUpDownload(file);
354 } 354 }
355 355
356 } // namespace 356 } // namespace
OLDNEW
« 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