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

Side by Side Diff: chrome_frame/test/test_server_test.cc

Issue 10019015: Update uses of TimeDelta in chrome_frame/*. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Another rebase onto master. Created 8 years, 8 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 | « chrome_frame/test/test_server.cc ('k') | chrome_frame/test/ui_test.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <windows.h> 5 #include <windows.h>
6 #include <wininet.h> 6 #include <wininet.h>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 test_server::FileResponse file("/file", source_path().Append( 140 test_server::FileResponse file("/file", source_path().Append(
141 FILE_PATH_LITERAL("CFInstance.js"))); 141 FILE_PATH_LITERAL("CFInstance.js")));
142 server.AddResponse(&file); 142 server.AddResponse(&file);
143 test_server::RedirectResponse redir("/goog", "http://www.google.com/"); 143 test_server::RedirectResponse redir("/goog", "http://www.google.com/");
144 server.AddResponse(&redir); 144 server.AddResponse(&redir);
145 145
146 // We should never hit this, but it's our way to break out of the test if 146 // We should never hit this, but it's our way to break out of the test if
147 // things start hanging. 147 // things start hanging.
148 QuitMessageHit quit_msg(&loop); 148 QuitMessageHit quit_msg(&loop);
149 loop.PostDelayedTask(FROM_HERE, base::Bind(QuitMessageLoop, &quit_msg), 149 loop.PostDelayedTask(FROM_HERE, base::Bind(QuitMessageLoop, &quit_msg),
150 10 * 1000); 150 base::TimeDelta::FromSeconds(10));
151 151
152 UrlTaskChain quit_task("http://localhost:1337/quit", NULL); 152 UrlTaskChain quit_task("http://localhost:1337/quit", NULL);
153 UrlTaskChain fnf_task("http://localhost:1337/404", &quit_task); 153 UrlTaskChain fnf_task("http://localhost:1337/404", &quit_task);
154 UrlTaskChain person_task("http://localhost:1337/person", &fnf_task); 154 UrlTaskChain person_task("http://localhost:1337/person", &fnf_task);
155 UrlTaskChain file_task("http://localhost:1337/file", &person_task); 155 UrlTaskChain file_task("http://localhost:1337/file", &person_task);
156 UrlTaskChain goog_task("http://localhost:1337/goog", &file_task); 156 UrlTaskChain goog_task("http://localhost:1337/goog", &file_task);
157 157
158 DWORD tid = 0; 158 DWORD tid = 0;
159 base::win::ScopedHandle worker(::CreateThread( 159 base::win::ScopedHandle worker(::CreateThread(
160 NULL, 0, FetchUrl, &goog_task, 0, &tid)); 160 NULL, 0, FetchUrl, &goog_task, 0, &tid));
161 loop.MessageLoop::Run(); 161 loop.MessageLoop::Run();
162 162
163 EXPECT_FALSE(quit_msg.hit_); 163 EXPECT_FALSE(quit_msg.hit_);
164 if (!quit_msg.hit_) { 164 if (!quit_msg.hit_) {
165 EXPECT_EQ(::WaitForSingleObject(worker, 10 * 1000), WAIT_OBJECT_0); 165 EXPECT_EQ(::WaitForSingleObject(worker, 10 * 1000), WAIT_OBJECT_0);
166 166
167 EXPECT_EQ(person.accessed(), 1); 167 EXPECT_EQ(person.accessed(), 1);
168 EXPECT_EQ(file.accessed(), 1); 168 EXPECT_EQ(file.accessed(), 1);
169 EXPECT_EQ(redir.accessed(), 1); 169 EXPECT_EQ(redir.accessed(), 1);
170 170
171 EXPECT_TRUE(person_task.response().find("Guthrie") != std::string::npos); 171 EXPECT_TRUE(person_task.response().find("Guthrie") != std::string::npos);
172 EXPECT_TRUE(file_task.response().find("function") != std::string::npos); 172 EXPECT_TRUE(file_task.response().find("function") != std::string::npos);
173 EXPECT_TRUE(goog_task.response().find("<title>") != std::string::npos); 173 EXPECT_TRUE(goog_task.response().find("<title>") != std::string::npos);
174 } else { 174 } else {
175 ::TerminateThread(worker, ~0); 175 ::TerminateThread(worker, ~0);
176 } 176 }
177 } 177 }
OLDNEW
« no previous file with comments | « chrome_frame/test/test_server.cc ('k') | chrome_frame/test/ui_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698