Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: net/proxy/proxy_resolver_v8_unittest.cc

Issue 10546071: CapturingNetLog - remove maximum entries constructor argument. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/file_util.h" 6 #include "base/file_util.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 const GURL kQueryUrl("http://www.google.com"); 123 const GURL kQueryUrl("http://www.google.com");
124 const GURL kPacUrl; 124 const GURL kPacUrl;
125 125
126 126
127 TEST(ProxyResolverV8Test, Direct) { 127 TEST(ProxyResolverV8Test, Direct) {
128 ProxyResolverV8WithMockBindings resolver; 128 ProxyResolverV8WithMockBindings resolver;
129 int result = resolver.SetPacScriptFromDisk("direct.js"); 129 int result = resolver.SetPacScriptFromDisk("direct.js");
130 EXPECT_EQ(OK, result); 130 EXPECT_EQ(OK, result);
131 131
132 ProxyInfo proxy_info; 132 ProxyInfo proxy_info;
133 CapturingBoundNetLog log(CapturingNetLog::kUnbounded); 133 CapturingBoundNetLog log;
134 result = resolver.GetProxyForURL( 134 result = resolver.GetProxyForURL(
135 kQueryUrl, &proxy_info, CompletionCallback(), NULL, log.bound()); 135 kQueryUrl, &proxy_info, CompletionCallback(), NULL, log.bound());
136 136
137 EXPECT_EQ(OK, result); 137 EXPECT_EQ(OK, result);
138 EXPECT_TRUE(proxy_info.is_direct()); 138 EXPECT_TRUE(proxy_info.is_direct());
139 139
140 EXPECT_EQ(0U, resolver.mock_js_bindings()->alerts.size()); 140 EXPECT_EQ(0U, resolver.mock_js_bindings()->alerts.size());
141 EXPECT_EQ(0U, resolver.mock_js_bindings()->errors.size()); 141 EXPECT_EQ(0U, resolver.mock_js_bindings()->errors.size());
142 142
143 net::CapturingNetLog::CapturedEntryList entries; 143 net::CapturingNetLog::CapturedEntryList entries;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 // Try loading a PAC script that ends with a comment and has no terminal 468 // Try loading a PAC script that ends with a comment and has no terminal
469 // newline. This should not cause problems with the PAC utility functions 469 // newline. This should not cause problems with the PAC utility functions
470 // that we add to the script's environment. 470 // that we add to the script's environment.
471 // http://crbug.com/22864 471 // http://crbug.com/22864
472 TEST(ProxyResolverV8Test, EndsWithCommentNoNewline) { 472 TEST(ProxyResolverV8Test, EndsWithCommentNoNewline) {
473 ProxyResolverV8WithMockBindings resolver; 473 ProxyResolverV8WithMockBindings resolver;
474 int result = resolver.SetPacScriptFromDisk("ends_with_comment.js"); 474 int result = resolver.SetPacScriptFromDisk("ends_with_comment.js");
475 EXPECT_EQ(OK, result); 475 EXPECT_EQ(OK, result);
476 476
477 ProxyInfo proxy_info; 477 ProxyInfo proxy_info;
478 CapturingBoundNetLog log(CapturingNetLog::kUnbounded);
479 result = resolver.GetProxyForURL( 478 result = resolver.GetProxyForURL(
480 kQueryUrl, &proxy_info, CompletionCallback(), NULL, log.bound()); 479 kQueryUrl, &proxy_info, CompletionCallback(), NULL, BoundNetLog());
481 480
482 EXPECT_EQ(OK, result); 481 EXPECT_EQ(OK, result);
483 EXPECT_FALSE(proxy_info.is_direct()); 482 EXPECT_FALSE(proxy_info.is_direct());
484 EXPECT_EQ("success:80", proxy_info.proxy_server().ToURI()); 483 EXPECT_EQ("success:80", proxy_info.proxy_server().ToURI());
485 } 484 }
486 485
487 // Try loading a PAC script that ends with a statement and has no terminal 486 // Try loading a PAC script that ends with a statement and has no terminal
488 // newline. This should not cause problems with the PAC utility functions 487 // newline. This should not cause problems with the PAC utility functions
489 // that we add to the script's environment. 488 // that we add to the script's environment.
490 // http://crbug.com/22864 489 // http://crbug.com/22864
491 TEST(ProxyResolverV8Test, EndsWithStatementNoNewline) { 490 TEST(ProxyResolverV8Test, EndsWithStatementNoNewline) {
492 ProxyResolverV8WithMockBindings resolver; 491 ProxyResolverV8WithMockBindings resolver;
493 int result = resolver.SetPacScriptFromDisk( 492 int result = resolver.SetPacScriptFromDisk(
494 "ends_with_statement_no_semicolon.js"); 493 "ends_with_statement_no_semicolon.js");
495 EXPECT_EQ(OK, result); 494 EXPECT_EQ(OK, result);
496 495
497 ProxyInfo proxy_info; 496 ProxyInfo proxy_info;
498 CapturingBoundNetLog log(CapturingNetLog::kUnbounded);
499 result = resolver.GetProxyForURL( 497 result = resolver.GetProxyForURL(
500 kQueryUrl, &proxy_info, CompletionCallback(), NULL, log.bound()); 498 kQueryUrl, &proxy_info, CompletionCallback(), NULL, BoundNetLog());
501 499
502 EXPECT_EQ(OK, result); 500 EXPECT_EQ(OK, result);
503 EXPECT_FALSE(proxy_info.is_direct()); 501 EXPECT_FALSE(proxy_info.is_direct());
504 EXPECT_EQ("success:3", proxy_info.proxy_server().ToURI()); 502 EXPECT_EQ("success:3", proxy_info.proxy_server().ToURI());
505 } 503 }
506 504
507 // Test the return values from myIpAddress(), myIpAddressEx(), dnsResolve(), 505 // Test the return values from myIpAddress(), myIpAddressEx(), dnsResolve(),
508 // dnsResolveEx(), isResolvable(), isResolvableEx(), when the the binding 506 // dnsResolveEx(), isResolvable(), isResolvableEx(), when the the binding
509 // returns empty string (failure). This simulates the return values from 507 // returns empty string (failure). This simulates the return values from
510 // those functions when the underlying DNS resolution fails. 508 // those functions when the underlying DNS resolution fails.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 EXPECT_TRUE(proxy_info.is_direct()); 562 EXPECT_TRUE(proxy_info.is_direct());
565 563
566 // We called dnsResolveEx() exactly once, by passing through the "host" 564 // We called dnsResolveEx() exactly once, by passing through the "host"
567 // argument to FindProxyForURL(). The brackets should have been stripped. 565 // argument to FindProxyForURL(). The brackets should have been stripped.
568 ASSERT_EQ(1U, resolver.mock_js_bindings()->dns_resolves_ex.size()); 566 ASSERT_EQ(1U, resolver.mock_js_bindings()->dns_resolves_ex.size());
569 EXPECT_EQ("abcd::efff", resolver.mock_js_bindings()->dns_resolves_ex[0]); 567 EXPECT_EQ("abcd::efff", resolver.mock_js_bindings()->dns_resolves_ex[0]);
570 } 568 }
571 569
572 } // namespace 570 } // namespace
573 } // namespace net 571 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_resolver_js_bindings_unittest.cc ('k') | net/proxy/proxy_script_decider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698