Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "net/proxy/proxy_script_fetcher.h" | 5 #include "net/proxy/proxy_script_fetcher.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 { | 186 { |
| 187 std::string bytes; | 187 std::string bytes; |
| 188 TestCompletionCallback callback; | 188 TestCompletionCallback callback; |
| 189 int result = pac_fetcher->Fetch(url, &bytes, &callback); | 189 int result = pac_fetcher->Fetch(url, &bytes, &callback); |
| 190 EXPECT_EQ(ERR_IO_PENDING, result); | 190 EXPECT_EQ(ERR_IO_PENDING, result); |
| 191 EXPECT_EQ(OK, callback.WaitForResult()); | 191 EXPECT_EQ(OK, callback.WaitForResult()); |
| 192 EXPECT_EQ("-cacheable_1hr.pac-\n", bytes); | 192 EXPECT_EQ("-cacheable_1hr.pac-\n", bytes); |
| 193 } | 193 } |
| 194 | 194 |
| 195 // Now kill the HTTP server. | 195 // Now kill the HTTP server. |
| 196 server->SendQuit(); | 196 EXPECT_TRUE(server->Stop()); // Verify it shutdown synchronously. |
|
wtc
2009/10/22 21:38:58
Nit: shutdown => shut down (past tense?)
| |
| 197 EXPECT_TRUE(server->WaitToFinish(20000)); | |
| 198 server = NULL; | 197 server = NULL; |
| 199 | 198 |
| 200 // Try to fetch the file again -- if should fail, since the server is not | 199 // Try to fetch the file again -- if should fail, since the server is not |
| 201 // running anymore. (If it were instead being loaded from cache, we would | 200 // running anymore. (If it were instead being loaded from cache, we would |
| 202 // get a success. | 201 // get a success. |
| 203 { | 202 { |
| 204 std::string bytes; | 203 std::string bytes; |
| 205 TestCompletionCallback callback; | 204 TestCompletionCallback callback; |
| 206 int result = pac_fetcher->Fetch(url, &bytes, &callback); | 205 int result = pac_fetcher->Fetch(url, &bytes, &callback); |
| 207 EXPECT_EQ(ERR_IO_PENDING, result); | 206 EXPECT_EQ(ERR_IO_PENDING, result); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 std::string bytes; | 317 std::string bytes; |
| 319 TestCompletionCallback callback; | 318 TestCompletionCallback callback; |
| 320 int result = pac_fetcher->Fetch(url, &bytes, &callback); | 319 int result = pac_fetcher->Fetch(url, &bytes, &callback); |
| 321 EXPECT_EQ(ERR_IO_PENDING, result); | 320 EXPECT_EQ(ERR_IO_PENDING, result); |
| 322 EXPECT_EQ(OK, callback.WaitForResult()); | 321 EXPECT_EQ(OK, callback.WaitForResult()); |
| 323 EXPECT_EQ("This was encoded as UTF-16BE.\n", bytes); | 322 EXPECT_EQ("This was encoded as UTF-16BE.\n", bytes); |
| 324 } | 323 } |
| 325 } | 324 } |
| 326 | 325 |
| 327 } // namespace net | 326 } // namespace net |
| OLD | NEW |