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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_apitest.cc

Issue 2890293005: Network traffic annotation stored in url_request. (Closed)
Patch Set: 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
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/macros.h" 6 #include "base/macros.h"
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/optional.h" 8 #include "base/optional.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 }; 798 };
799 base::RunLoop run_loop; 799 base::RunLoop run_loop;
800 TestURLFetcherDelegate delegate(run_loop.QuitClosure()); 800 TestURLFetcherDelegate delegate(run_loop.QuitClosure());
801 801
802 net::URLFetcherImplFactory url_fetcher_impl_factory; 802 net::URLFetcherImplFactory url_fetcher_impl_factory;
803 net::FakeURLFetcherFactory url_fetcher_factory(&url_fetcher_impl_factory); 803 net::FakeURLFetcherFactory url_fetcher_factory(&url_fetcher_impl_factory);
804 url_fetcher_factory.SetFakeResponse(GURL("https://client1.google.com"), 804 url_fetcher_factory.SetFakeResponse(GURL("https://client1.google.com"),
805 "hello my friend", net::HTTP_OK, 805 "hello my friend", net::HTTP_OK,
806 net::URLRequestStatus::SUCCESS); 806 net::URLRequestStatus::SUCCESS);
807 std::unique_ptr<net::URLFetcher> fetcher = 807 std::unique_ptr<net::URLFetcher> fetcher =
808 url_fetcher_factory.CreateURLFetcher(1, 808 url_fetcher_factory.CreateURLFetcher(
809 GURL("https://client1.google.com"), 809 1, GURL("https://client1.google.com"), net::URLFetcher::GET,
810 net::URLFetcher::GET, &delegate); 810 &delegate, TRAFFIC_ANNOTATION_FOR_TESTS);
811 fetcher->Start(); 811 fetcher->Start();
812 run_loop.Run(); 812 run_loop.Run();
813 813
814 // This request should not be observed by the extension. 814 // This request should not be observed by the extension.
815 EXPECT_EQ(expected_requests_observed, 815 EXPECT_EQ(expected_requests_observed,
816 GetWebRequestCountFromBackgroundPage(extension, profile())); 816 GetWebRequestCountFromBackgroundPage(extension, profile()));
817 } 817 }
818 818
819 // Test that the webRequest events are dispatched for the WebSocket handshake 819 // Test that the webRequest events are dispatched for the WebSocket handshake
820 // requests. 820 // requests.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 // request context. 948 // request context.
949 SCOPED_TRACE("example.com with System's request context"); 949 SCOPED_TRACE("example.com with System's request context");
950 TestURLFetcherDelegate url_fetcher(system_context, example_url, 950 TestURLFetcherDelegate url_fetcher(system_context, example_url,
951 net::URLRequestStatus()); 951 net::URLRequestStatus());
952 url_fetcher.SetExpectedResponse(kExampleFullContent); 952 url_fetcher.SetExpectedResponse(kExampleFullContent);
953 url_fetcher.WaitForCompletion(); 953 url_fetcher.WaitForCompletion();
954 } 954 }
955 } 955 }
956 956
957 } // namespace extensions 957 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698