| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/waitable_event.h" | 5 #include "base/waitable_event.h" |
| 6 #include "googleurl/src/gurl.h" | 6 #include "googleurl/src/gurl.h" |
| 7 #include "net/base/load_log.h" | 7 #include "net/base/load_log.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 #include "net/base/test_completion_callback.h" | 9 #include "net/base/test_completion_callback.h" |
| 10 #include "net/proxy/proxy_info.h" | 10 #include "net/proxy/proxy_info.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // Call SetPacScriptByData() -- verify that it reaches the synchronous | 148 // Call SetPacScriptByData() -- verify that it reaches the synchronous |
| 149 // resolver. | 149 // resolver. |
| 150 TestCompletionCallback set_script_callback; | 150 TestCompletionCallback set_script_callback; |
| 151 rv = resolver->SetPacScriptByData("pac script bytes", &set_script_callback); | 151 rv = resolver->SetPacScriptByData("pac script bytes", &set_script_callback); |
| 152 EXPECT_EQ(ERR_IO_PENDING, rv); | 152 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 153 EXPECT_EQ(OK, set_script_callback.WaitForResult()); | 153 EXPECT_EQ(OK, set_script_callback.WaitForResult()); |
| 154 EXPECT_EQ("pac script bytes", mock->last_pac_bytes()); | 154 EXPECT_EQ("pac script bytes", mock->last_pac_bytes()); |
| 155 | 155 |
| 156 // Start request 0. | 156 // Start request 0. |
| 157 TestCompletionCallback callback0; | 157 TestCompletionCallback callback0; |
| 158 scoped_refptr<LoadLog> log0(new LoadLog); | 158 scoped_refptr<LoadLog> log0(new LoadLog(LoadLog::kUnbounded)); |
| 159 ProxyInfo results0; | 159 ProxyInfo results0; |
| 160 rv = resolver->GetProxyForURL( | 160 rv = resolver->GetProxyForURL( |
| 161 GURL("http://request0"), &results0, &callback0, NULL, log0); | 161 GURL("http://request0"), &results0, &callback0, NULL, log0); |
| 162 EXPECT_EQ(ERR_IO_PENDING, rv); | 162 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 163 | 163 |
| 164 // Wait for request 0 to finish. | 164 // Wait for request 0 to finish. |
| 165 rv = callback0.WaitForResult(); | 165 rv = callback0.WaitForResult(); |
| 166 EXPECT_EQ(0, rv); | 166 EXPECT_EQ(0, rv); |
| 167 EXPECT_EQ("PROXY request0:80", results0.ToPacString()); | 167 EXPECT_EQ("PROXY request0:80", results0.ToPacString()); |
| 168 | 168 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 rv = callback1.WaitForResult(); | 393 rv = callback1.WaitForResult(); |
| 394 EXPECT_EQ(1, rv); | 394 EXPECT_EQ(1, rv); |
| 395 EXPECT_EQ("PROXY request1:80", results1.ToPacString()); | 395 EXPECT_EQ("PROXY request1:80", results1.ToPacString()); |
| 396 | 396 |
| 397 // The SetPacScript callback should never have been completed. | 397 // The SetPacScript callback should never have been completed. |
| 398 EXPECT_FALSE(set_pac_script_callback.have_result()); | 398 EXPECT_FALSE(set_pac_script_callback.have_result()); |
| 399 } | 399 } |
| 400 | 400 |
| 401 } // namespace | 401 } // namespace |
| 402 } // namespace net | 402 } // namespace net |
| OLD | NEW |