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

Side by Side Diff: chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc

Issue 2804023003: Network traffic annotation added to chrome/browser/ unittests. (Closed)
Patch Set: Another missing header added. Created 3 years, 8 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/data_usage/tab_id_annotator_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 "chrome/browser/custom_handlers/protocol_handler_registry.h" 5 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 10 matching lines...) Expand all
21 #include "chrome/test/base/testing_browser_process.h" 21 #include "chrome/test/base/testing_browser_process.h"
22 #include "chrome/test/base/testing_profile.h" 22 #include "chrome/test/base/testing_profile.h"
23 #include "components/pref_registry/pref_registry_syncable.h" 23 #include "components/pref_registry/pref_registry_syncable.h"
24 #include "components/sync_preferences/pref_service_syncable.h" 24 #include "components/sync_preferences/pref_service_syncable.h"
25 #include "content/public/browser/notification_observer.h" 25 #include "content/public/browser/notification_observer.h"
26 #include "content/public/browser/notification_registrar.h" 26 #include "content/public/browser/notification_registrar.h"
27 #include "content/public/browser/notification_source.h" 27 #include "content/public/browser/notification_source.h"
28 #include "content/public/test/test_browser_thread.h" 28 #include "content/public/test/test_browser_thread.h"
29 #include "content/public/test/test_renderer_host.h" 29 #include "content/public/test/test_renderer_host.h"
30 #include "net/base/request_priority.h" 30 #include "net/base/request_priority.h"
31 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
31 #include "net/url_request/url_request.h" 32 #include "net/url_request/url_request.h"
32 #include "net/url_request/url_request_context.h" 33 #include "net/url_request/url_request_context.h"
33 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
34 35
35 using content::BrowserThread; 36 using content::BrowserThread;
36 37
37 namespace { 38 namespace {
38 39
39 void AssertInterceptedIO( 40 void AssertInterceptedIO(
40 const GURL& url, 41 const GURL& url,
41 net::URLRequestJobFactory* interceptor) { 42 net::URLRequestJobFactory* interceptor) {
42 DCHECK_CURRENTLY_ON(BrowserThread::IO); 43 DCHECK_CURRENTLY_ON(BrowserThread::IO);
43 net::URLRequestContext context; 44 net::URLRequestContext context;
44 std::unique_ptr<net::URLRequest> request( 45 std::unique_ptr<net::URLRequest> request(context.CreateRequest(
45 context.CreateRequest(url, net::DEFAULT_PRIORITY, nullptr)); 46 url, net::DEFAULT_PRIORITY, nullptr, TRAFFIC_ANNOTATION_FOR_TESTS));
46 std::unique_ptr<net::URLRequestJob> job( 47 std::unique_ptr<net::URLRequestJob> job(
47 interceptor->MaybeCreateJobWithProtocolHandler( 48 interceptor->MaybeCreateJobWithProtocolHandler(
48 url.scheme(), request.get(), context.network_delegate())); 49 url.scheme(), request.get(), context.network_delegate()));
49 ASSERT_TRUE(job.get()); 50 ASSERT_TRUE(job.get());
50 } 51 }
51 52
52 void AssertIntercepted( 53 void AssertIntercepted(
53 const GURL& url, 54 const GURL& url,
54 net::URLRequestJobFactory* interceptor) { 55 net::URLRequestJobFactory* interceptor) {
55 DCHECK_CURRENTLY_ON(BrowserThread::UI); 56 DCHECK_CURRENTLY_ON(BrowserThread::UI);
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 // added to pref. 1084 // added to pref.
1084 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2); 1085 ASSERT_EQ(InPrefIgnoredHandlerCount(), 2);
1085 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); 1086 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4);
1086 1087
1087 registry()->RemoveIgnoredHandler(p2u1); 1088 registry()->RemoveIgnoredHandler(p2u1);
1088 1089
1089 // p2u1 installed by user and policy, so it is removed from pref alone. 1090 // p2u1 installed by user and policy, so it is removed from pref alone.
1090 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1); 1091 ASSERT_EQ(InPrefIgnoredHandlerCount(), 1);
1091 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4); 1092 ASSERT_EQ(InMemoryIgnoredHandlerCount(), 4);
1092 } 1093 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/data_usage/tab_id_annotator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698