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

Side by Side Diff: chrome/browser/net/proxy_browsertest.cc

Issue 2895173002: Network traffic annotation added to browser unittests. (Closed)
Patch Set: One more file added. Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/predictors/resource_prefetch_predictor_unittest.cc » ('j') | 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) 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/public/browser/notification_source.h" 23 #include "content/public/browser/notification_source.h"
24 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
25 #include "content/public/browser/web_contents_observer.h" 25 #include "content/public/browser/web_contents_observer.h"
26 #include "content/public/common/content_switches.h" 26 #include "content/public/common/content_switches.h"
27 #include "content/public/test/browser_test_utils.h" 27 #include "content/public/test/browser_test_utils.h"
28 #include "net/base/load_flags.h" 28 #include "net/base/load_flags.h"
29 #include "net/test/embedded_test_server/embedded_test_server.h" 29 #include "net/test/embedded_test_server/embedded_test_server.h"
30 #include "net/test/embedded_test_server/embedded_test_server_connection_listener .h" 30 #include "net/test/embedded_test_server/embedded_test_server_connection_listener .h"
31 #include "net/test/spawned_test_server/spawned_test_server.h" 31 #include "net/test/spawned_test_server/spawned_test_server.h"
32 #include "net/test/test_data_directory.h" 32 #include "net/test/test_data_directory.h"
33 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
33 #include "net/url_request/url_fetcher.h" 34 #include "net/url_request/url_fetcher.h"
34 #include "net/url_request/url_fetcher_delegate.h" 35 #include "net/url_request/url_fetcher_delegate.h"
35 #include "url/gurl.h" 36 #include "url/gurl.h"
36 37
37 namespace { 38 namespace {
38 39
39 // PAC script that sends all requests to an invalid proxy server. 40 // PAC script that sends all requests to an invalid proxy server.
40 const base::FilePath::CharType kPACScript[] = FILE_PATH_LITERAL( 41 const base::FilePath::CharType kPACScript[] = FILE_PATH_LITERAL(
41 "bad_server.pac"); 42 "bad_server.pac");
42 43
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 357
357 // Check that the URLRequest for a PAC that is still alive during shutdown is 358 // Check that the URLRequest for a PAC that is still alive during shutdown is
358 // safely cleaned up. This test relies on AssertNoURLRequests being called on 359 // safely cleaned up. This test relies on AssertNoURLRequests being called on
359 // the main URLRequestContext. 360 // the main URLRequestContext.
360 IN_PROC_BROWSER_TEST_F(HangingPacRequestProxyScriptBrowserTest, Shutdown) { 361 IN_PROC_BROWSER_TEST_F(HangingPacRequestProxyScriptBrowserTest, Shutdown) {
361 // Request that should hang while trying to request the PAC script. 362 // Request that should hang while trying to request the PAC script.
362 // Enough requests are created on startup that this probably isn't needed, but 363 // Enough requests are created on startup that this probably isn't needed, but
363 // best to be safe. 364 // best to be safe.
364 HangingURLFetcherDelegate hanging_request_delegate; 365 HangingURLFetcherDelegate hanging_request_delegate;
365 std::unique_ptr<net::URLFetcher> hanging_fetcher = net::URLFetcher::Create( 366 std::unique_ptr<net::URLFetcher> hanging_fetcher = net::URLFetcher::Create(
366 GURL("http://blah/"), net::URLFetcher::GET, &hanging_request_delegate); 367 GURL("http://blah/"), net::URLFetcher::GET, &hanging_request_delegate,
368 TRAFFIC_ANNOTATION_FOR_TESTS);
367 hanging_fetcher->SetRequestContext(browser()->profile()->GetRequestContext()); 369 hanging_fetcher->SetRequestContext(browser()->profile()->GetRequestContext());
368 hanging_fetcher->Start(); 370 hanging_fetcher->Start();
369 371
370 connection_listener_->Wait(); 372 connection_listener_->Wait();
371 } 373 }
372 374
373 } // namespace 375 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/predictors/resource_prefetch_predictor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698