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

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

Issue 150413003: Merge 248514 "Update V8 to version 3.24.30.1 (based on bleeding_..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1820/src/
Patch Set: Created 6 years, 10 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 | « chrome/browser/extensions/error_console/error_console_browsertest.cc ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "net/proxy/proxy_resolver_v8_tracing.h" 5 #include "net/proxy/proxy_resolver_v8_tracing.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 int rv = resolver.GetProxyForURL( 142 int rv = resolver.GetProxyForURL(
143 GURL("http://throw-an-error/"), &proxy_info, callback.callback(), NULL, 143 GURL("http://throw-an-error/"), &proxy_info, callback.callback(), NULL,
144 request_log.bound()); 144 request_log.bound());
145 145
146 EXPECT_EQ(ERR_IO_PENDING, rv); 146 EXPECT_EQ(ERR_IO_PENDING, rv);
147 EXPECT_EQ(ERR_PAC_SCRIPT_FAILED, callback.WaitForResult()); 147 EXPECT_EQ(ERR_PAC_SCRIPT_FAILED, callback.WaitForResult());
148 148
149 EXPECT_EQ(0u, host_resolver.num_resolve()); 149 EXPECT_EQ(0u, host_resolver.num_resolve());
150 150
151 EXPECT_EQ("Error: line 5: Uncaught TypeError: Cannot call method 'split' " 151 EXPECT_EQ("Error: line 5: Uncaught TypeError: Cannot read property 'split' "
152 "of null\n", error_observer->GetOutput()); 152 "of null\n", error_observer->GetOutput());
153 153
154 // Check the NetLogs -- there was 1 alert and 1 javascript error, and they 154 // Check the NetLogs -- there was 1 alert and 1 javascript error, and they
155 // were output to both the global log, and per-request log. 155 // were output to both the global log, and per-request log.
156 CapturingNetLog::CapturedEntryList entries_list[2]; 156 CapturingNetLog::CapturedEntryList entries_list[2];
157 log.GetEntries(&entries_list[0]); 157 log.GetEntries(&entries_list[0]);
158 request_log.GetEntries(&entries_list[1]); 158 request_log.GetEntries(&entries_list[1]);
159 159
160 for (size_t list_i = 0; list_i < arraysize(entries_list); list_i++) { 160 for (size_t list_i = 0; list_i < arraysize(entries_list); list_i++) {
161 const CapturingNetLog::CapturedEntryList& entries = entries_list[list_i]; 161 const CapturingNetLog::CapturedEntryList& entries = entries_list[list_i];
162 EXPECT_EQ(2u, entries.size()); 162 EXPECT_EQ(2u, entries.size());
163 EXPECT_TRUE( 163 EXPECT_TRUE(
164 LogContainsEvent(entries, 0, NetLog::TYPE_PAC_JAVASCRIPT_ALERT, 164 LogContainsEvent(entries, 0, NetLog::TYPE_PAC_JAVASCRIPT_ALERT,
165 NetLog::PHASE_NONE)); 165 NetLog::PHASE_NONE));
166 EXPECT_TRUE( 166 EXPECT_TRUE(
167 LogContainsEvent(entries, 1, NetLog::TYPE_PAC_JAVASCRIPT_ERROR, 167 LogContainsEvent(entries, 1, NetLog::TYPE_PAC_JAVASCRIPT_ERROR,
168 NetLog::PHASE_NONE)); 168 NetLog::PHASE_NONE));
169 169
170 EXPECT_EQ("{\"message\":\"Prepare to DIE!\"}", entries[0].GetParamsJson()); 170 EXPECT_EQ("{\"message\":\"Prepare to DIE!\"}", entries[0].GetParamsJson());
171 EXPECT_EQ("{\"line_number\":5,\"message\":\"Uncaught TypeError: Cannot " 171 EXPECT_EQ("{\"line_number\":5,\"message\":\"Uncaught TypeError: Cannot "
172 "call method 'split' of null\"}", entries[1].GetParamsJson()); 172 "read property 'split' of null\"}", entries[1].GetParamsJson());
173 } 173 }
174 } 174 }
175 175
176 TEST_F(ProxyResolverV8TracingTest, TooManyAlerts) { 176 TEST_F(ProxyResolverV8TracingTest, TooManyAlerts) {
177 CapturingNetLog log; 177 CapturingNetLog log;
178 CapturingBoundNetLog request_log; 178 CapturingBoundNetLog request_log;
179 MockCachingHostResolver host_resolver; 179 MockCachingHostResolver host_resolver;
180 MockErrorObserver* error_observer = new MockErrorObserver; 180 MockErrorObserver* error_observer = new MockErrorObserver;
181 ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log); 181 ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log);
182 182
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 proxy_uri.substr(0, proxy_uri.find(':') + 1)); 1090 proxy_uri.substr(0, proxy_uri.find(':') + 1));
1091 } else { 1091 } else {
1092 NOTREACHED(); 1092 NOTREACHED();
1093 } 1093 }
1094 } 1094 }
1095 } 1095 }
1096 1096
1097 } // namespace 1097 } // namespace
1098 1098
1099 } // namespace net 1099 } // namespace net
OLDNEW
« no previous file with comments | « chrome/browser/extensions/error_console/error_console_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698