OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/api/gcd_private/privet_v3_context_getter.h" | 5 #include "chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/test/test_browser_thread_bundle.h" | 15 #include "content/public/test/test_browser_thread_bundle.h" |
16 #include "net/test/embedded_test_server/embedded_test_server.h" | 16 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 17 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" |
17 #include "net/url_request/url_fetcher.h" | 18 #include "net/url_request/url_fetcher.h" |
18 #include "net/url_request/url_fetcher_delegate.h" | 19 #include "net/url_request/url_fetcher_delegate.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 | 21 |
21 namespace extensions { | 22 namespace extensions { |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 using content::BrowserThread; | 26 using content::BrowserThread; |
26 using net::EmbeddedTestServer; | 27 using net::EmbeddedTestServer; |
(...skipping 28 matching lines...) Expand all Loading... |
55 } | 56 } |
56 | 57 |
57 net::URLRequestStatus::Status Run() { | 58 net::URLRequestStatus::Status Run() { |
58 done_ = false; | 59 done_ = false; |
59 status_ = net::URLRequestStatus(); | 60 status_ = net::URLRequestStatus(); |
60 | 61 |
61 base::RunLoop run_loop; | 62 base::RunLoop run_loop; |
62 quit_ = run_loop.QuitClosure(); | 63 quit_ = run_loop.QuitClosure(); |
63 | 64 |
64 fetcher_ = net::URLFetcher::Create(server_->GetURL("/simple.html"), | 65 fetcher_ = net::URLFetcher::Create(server_->GetURL("/simple.html"), |
65 net::URLFetcher::GET, this); | 66 net::URLFetcher::GET, this, |
| 67 TRAFFIC_ANNOTATION_FOR_TESTS); |
66 fetcher_->SetRequestContext(context_getter_.get()); | 68 fetcher_->SetRequestContext(context_getter_.get()); |
67 fetcher_->Start(); | 69 fetcher_->Start(); |
68 | 70 |
69 run_loop.Run(); | 71 run_loop.Run(); |
70 | 72 |
71 EXPECT_TRUE(done_); | 73 EXPECT_TRUE(done_); |
72 return status_.status(); | 74 return status_.status(); |
73 } | 75 } |
74 | 76 |
75 void SetFingerprint(const net::SHA256HashValue& fingerprint) { | 77 void SetFingerprint(const net::SHA256HashValue& fingerprint) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 127 |
126 CreateServer(EmbeddedTestServer::TYPE_HTTPS); | 128 CreateServer(EmbeddedTestServer::TYPE_HTTPS); |
127 SetFingerprint(GetServerFingerprint()); | 129 SetFingerprint(GetServerFingerprint()); |
128 EXPECT_EQ(net::URLRequestStatus::SUCCESS, Run()); | 130 EXPECT_EQ(net::URLRequestStatus::SUCCESS, Run()); |
129 } | 131 } |
130 } | 132 } |
131 | 133 |
132 } // namespace | 134 } // namespace |
133 | 135 |
134 } // namespace extensions | 136 } // namespace extensions |
OLD | NEW |