| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/scoped_handle_win.h" | 10 #include "base/win/scoped_handle.h" |
| 11 #include "chrome_frame/test/test_server.h" | 11 #include "chrome_frame/test/test_server.h" |
| 12 #include "net/base/cookie_monster.h" | 12 #include "net/base/cookie_monster.h" |
| 13 #include "net/base/host_resolver_proc.h" | 13 #include "net/base/host_resolver_proc.h" |
| 14 #include "net/disk_cache/disk_cache.h" | 14 #include "net/disk_cache/disk_cache.h" |
| 15 #include "net/http/http_auth_handler_factory.h" | 15 #include "net/http/http_auth_handler_factory.h" |
| 16 #include "net/http/http_cache.h" | 16 #include "net/http/http_cache.h" |
| 17 #include "net/proxy/proxy_service.h" | 17 #include "net/proxy/proxy_service.h" |
| 18 #include "net/url_request/url_request.h" | 18 #include "net/url_request/url_request.h" |
| 19 #include "net/url_request/url_request_unittest.h" | 19 #include "net/url_request/url_request_unittest.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 NewRunnableFunction(QuitMessageLoop, &quit_msg), | 185 NewRunnableFunction(QuitMessageLoop, &quit_msg), |
| 186 10 * 1000); | 186 10 * 1000); |
| 187 | 187 |
| 188 UrlTaskChain quit_task("http://localhost:1337/quit", NULL); | 188 UrlTaskChain quit_task("http://localhost:1337/quit", NULL); |
| 189 UrlTaskChain fnf_task("http://localhost:1337/404", &quit_task); | 189 UrlTaskChain fnf_task("http://localhost:1337/404", &quit_task); |
| 190 UrlTaskChain person_task("http://localhost:1337/person", &fnf_task); | 190 UrlTaskChain person_task("http://localhost:1337/person", &fnf_task); |
| 191 UrlTaskChain file_task("http://localhost:1337/file", &person_task); | 191 UrlTaskChain file_task("http://localhost:1337/file", &person_task); |
| 192 UrlTaskChain goog_task("http://localhost:1337/goog", &file_task); | 192 UrlTaskChain goog_task("http://localhost:1337/goog", &file_task); |
| 193 | 193 |
| 194 DWORD tid = 0; | 194 DWORD tid = 0; |
| 195 ScopedHandle worker(::CreateThread(NULL, 0, FetchUrl, &goog_task, 0, &tid)); | 195 base::win::ScopedHandle worker(::CreateThread( |
| 196 NULL, 0, FetchUrl, &goog_task, 0, &tid)); |
| 196 loop.MessageLoop::Run(); | 197 loop.MessageLoop::Run(); |
| 197 | 198 |
| 198 EXPECT_FALSE(quit_msg.hit_); | 199 EXPECT_FALSE(quit_msg.hit_); |
| 199 if (!quit_msg.hit_) { | 200 if (!quit_msg.hit_) { |
| 200 EXPECT_EQ(::WaitForSingleObject(worker, 10 * 1000), WAIT_OBJECT_0); | 201 EXPECT_EQ(::WaitForSingleObject(worker, 10 * 1000), WAIT_OBJECT_0); |
| 201 | 202 |
| 202 EXPECT_EQ(person.accessed(), 1); | 203 EXPECT_EQ(person.accessed(), 1); |
| 203 EXPECT_EQ(file.accessed(), 1); | 204 EXPECT_EQ(file.accessed(), 1); |
| 204 EXPECT_EQ(redir.accessed(), 1); | 205 EXPECT_EQ(redir.accessed(), 1); |
| 205 | 206 |
| 206 EXPECT_TRUE(person_task.response().find("Guthrie") != std::string::npos); | 207 EXPECT_TRUE(person_task.response().find("Guthrie") != std::string::npos); |
| 207 EXPECT_TRUE(file_task.response().find("function") != std::string::npos); | 208 EXPECT_TRUE(file_task.response().find("function") != std::string::npos); |
| 208 EXPECT_TRUE(goog_task.response().find("<title>") != std::string::npos); | 209 EXPECT_TRUE(goog_task.response().find("<title>") != std::string::npos); |
| 209 } else { | 210 } else { |
| 210 ::TerminateThread(worker, ~0); | 211 ::TerminateThread(worker, ~0); |
| 211 } | 212 } |
| 212 } | 213 } |
| OLD | NEW |