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

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

Issue 238004: Add an additional unit-test for when PAC script is missing newline.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: reword a comment Created 11 years, 2 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
« no previous file with comments | « net/data/proxy_resolver_v8_unittest/ends_with_statement_no_semicolon.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 #include "net/base/load_log_unittest.h" 9 #include "net/base/load_log_unittest.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 ExpectLogContains(log, 2, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE, 413 ExpectLogContains(log, 2, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE,
414 LoadLog::PHASE_BEGIN); 414 LoadLog::PHASE_BEGIN);
415 ExpectLogContains(log, 3, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE, 415 ExpectLogContains(log, 3, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE,
416 LoadLog::PHASE_END); 416 LoadLog::PHASE_END);
417 ExpectLogContains(log, 4, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE, 417 ExpectLogContains(log, 4, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE,
418 LoadLog::PHASE_BEGIN); 418 LoadLog::PHASE_BEGIN);
419 ExpectLogContains(log, 5, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE, 419 ExpectLogContains(log, 5, LoadLog::TYPE_PROXY_RESOLVER_V8_DNS_RESOLVE,
420 LoadLog::PHASE_END); 420 LoadLog::PHASE_END);
421 } 421 }
422 422
423 // Try loading a PAC script which ends with a trailing comment (no terminal 423 // Try loading a PAC script that ends with a comment and has no terminal
424 // newline). This should not cause problems with the PAC utility functions 424 // newline. This should not cause problems with the PAC utility functions
425 // that we add to the script. 425 // that we add to the script's environment.
426 // http://crbug.com/22864 426 // http://crbug.com/22864
427 TEST(ProxyResolverV8Test, TrailingComment) { 427 TEST(ProxyResolverV8Test, EndsWithCommentNoNewline) {
428 ProxyResolverV8WithMockBindings resolver; 428 ProxyResolverV8WithMockBindings resolver;
429 int result = resolver.SetPacScriptFromDisk("ends_with_comment.js"); 429 int result = resolver.SetPacScriptFromDisk("ends_with_comment.js");
430 EXPECT_EQ(OK, result); 430 EXPECT_EQ(OK, result);
431 431
432 ProxyInfo proxy_info; 432 ProxyInfo proxy_info;
433 scoped_refptr<LoadLog> log(new LoadLog); 433 scoped_refptr<LoadLog> log(new LoadLog);
434 result = resolver.GetProxyForURL(kQueryUrl, &proxy_info, NULL, NULL, log); 434 result = resolver.GetProxyForURL(kQueryUrl, &proxy_info, NULL, NULL, log);
435 435
436 EXPECT_EQ(OK, result); 436 EXPECT_EQ(OK, result);
437 EXPECT_FALSE(proxy_info.is_direct()); 437 EXPECT_FALSE(proxy_info.is_direct());
438 EXPECT_EQ("success:80", proxy_info.proxy_server().ToURI()); 438 EXPECT_EQ("success:80", proxy_info.proxy_server().ToURI());
439 } 439 }
440 440
441 // Try loading a PAC script that ends with a statement and has no terminal
442 // newline. This should not cause problems with the PAC utility functions
443 // that we add to the script's environment.
444 // http://crbug.com/22864
445 TEST(ProxyResolverV8Test, EndsWithStatementNoNewline) {
446 ProxyResolverV8WithMockBindings resolver;
447 int result = resolver.SetPacScriptFromDisk(
448 "ends_with_statement_no_semicolon.js");
449 EXPECT_EQ(OK, result);
450
451 ProxyInfo proxy_info;
452 scoped_refptr<LoadLog> log(new LoadLog);
453 result = resolver.GetProxyForURL(kQueryUrl, &proxy_info, NULL, NULL, log);
454
455 EXPECT_EQ(OK, result);
456 EXPECT_FALSE(proxy_info.is_direct());
457 EXPECT_EQ("success:3", proxy_info.proxy_server().ToURI());
458 }
459
441 } // namespace 460 } // namespace
442 } // namespace net 461 } // namespace net
OLDNEW
« no previous file with comments | « net/data/proxy_resolver_v8_unittest/ends_with_statement_no_semicolon.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698