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 // TODO: replace expected value with 5 after V8 roll | 286 EXPECT_EQ(5, bindings->errors_line_number[0]); |
287 // EXPECT_EQ(0, bindings->errors_line_number[0]); | |
288 } | 287 } |
289 | 288 |
290 // Run a PAC script several times, which has side-effects. | 289 // Run a PAC script several times, which has side-effects. |
291 TEST(ProxyResolverV8Test, SideEffects) { | 290 TEST(ProxyResolverV8Test, SideEffects) { |
292 ProxyResolverV8WithMockBindings resolver; | 291 ProxyResolverV8WithMockBindings resolver; |
293 int result = resolver.SetPacScriptFromDisk("side_effects.js"); | 292 int result = resolver.SetPacScriptFromDisk("side_effects.js"); |
294 | 293 |
295 // The PAC script increments a counter each time we invoke it. | 294 // The PAC script increments a counter each time we invoke it. |
296 for (int i = 0; i < 3; ++i) { | 295 for (int i = 0; i < 3; ++i) { |
297 ProxyInfo proxy_info; | 296 ProxyInfo proxy_info; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 GURL("http://kittens/"), &proxy_info, | 664 GURL("http://kittens/"), &proxy_info, |
666 CompletionCallback(), NULL, BoundNetLog()); | 665 CompletionCallback(), NULL, BoundNetLog()); |
667 | 666 |
668 EXPECT_EQ(OK, result); | 667 EXPECT_EQ(OK, result); |
669 EXPECT_EQ(0u, bindings->errors.size()); | 668 EXPECT_EQ(0u, bindings->errors.size()); |
670 EXPECT_EQ("kittens:88", proxy_info.proxy_server().ToURI()); | 669 EXPECT_EQ("kittens:88", proxy_info.proxy_server().ToURI()); |
671 } | 670 } |
672 | 671 |
673 } // namespace | 672 } // namespace |
674 } // namespace net | 673 } // namespace net |
OLD | NEW |