| OLD | NEW |
| 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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 EXPECT_EQ(ERR_FAILED, result); | 276 EXPECT_EQ(ERR_FAILED, result); |
| 277 | 277 |
| 278 MockJSBindings* bindings = resolver.mock_js_bindings(); | 278 MockJSBindings* bindings = resolver.mock_js_bindings(); |
| 279 EXPECT_EQ(0U, bindings->alerts.size()); | 279 EXPECT_EQ(0U, bindings->alerts.size()); |
| 280 | 280 |
| 281 // We get one error during compilation. | 281 // We get one error during compilation. |
| 282 ASSERT_EQ(1U, bindings->errors.size()); | 282 ASSERT_EQ(1U, bindings->errors.size()); |
| 283 | 283 |
| 284 EXPECT_EQ("Uncaught SyntaxError: Unexpected end of input", | 284 EXPECT_EQ("Uncaught SyntaxError: Unexpected end of input", |
| 285 bindings->errors[0]); | 285 bindings->errors[0]); |
| 286 EXPECT_EQ(0, bindings->errors_line_number[0]); | 286 // TODO: replace expected value with 5 after V8 roll |
| 287 // EXPECT_EQ(0, bindings->errors_line_number[0]); |
| 287 } | 288 } |
| 288 | 289 |
| 289 // Run a PAC script several times, which has side-effects. | 290 // Run a PAC script several times, which has side-effects. |
| 290 TEST(ProxyResolverV8Test, SideEffects) { | 291 TEST(ProxyResolverV8Test, SideEffects) { |
| 291 ProxyResolverV8WithMockBindings resolver; | 292 ProxyResolverV8WithMockBindings resolver; |
| 292 int result = resolver.SetPacScriptFromDisk("side_effects.js"); | 293 int result = resolver.SetPacScriptFromDisk("side_effects.js"); |
| 293 | 294 |
| 294 // The PAC script increments a counter each time we invoke it. | 295 // The PAC script increments a counter each time we invoke it. |
| 295 for (int i = 0; i < 3; ++i) { | 296 for (int i = 0; i < 3; ++i) { |
| 296 ProxyInfo proxy_info; | 297 ProxyInfo proxy_info; |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 GURL("http://kittens/"), &proxy_info, | 665 GURL("http://kittens/"), &proxy_info, |
| 665 CompletionCallback(), NULL, BoundNetLog()); | 666 CompletionCallback(), NULL, BoundNetLog()); |
| 666 | 667 |
| 667 EXPECT_EQ(OK, result); | 668 EXPECT_EQ(OK, result); |
| 668 EXPECT_EQ(0u, bindings->errors.size()); | 669 EXPECT_EQ(0u, bindings->errors.size()); |
| 669 EXPECT_EQ("kittens:88", proxy_info.proxy_server().ToURI()); | 670 EXPECT_EQ("kittens:88", proxy_info.proxy_server().ToURI()); |
| 670 } | 671 } |
| 671 | 672 |
| 672 } // namespace | 673 } // namespace |
| 673 } // namespace net | 674 } // namespace net |
| OLD | NEW |