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

Side by Side Diff: google_apis/gaia/gaia_oauth_client_unittest.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 // A complete set of unit tests for GaiaOAuthClient. 5 // A complete set of unit tests for GaiaOAuthClient.
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "google_apis/gaia/gaia_oauth_client.h" 15 #include "google_apis/gaia/gaia_oauth_client.h"
16 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
17 #include "net/http/http_status_code.h" 17 #include "net/http/http_status_code.h"
18 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
18 #include "net/url_request/test_url_fetcher_factory.h" 19 #include "net/url_request/test_url_fetcher_factory.h"
19 #include "net/url_request/url_fetcher_delegate.h" 20 #include "net/url_request/url_fetcher_delegate.h"
20 #include "net/url_request/url_request_status.h" 21 #include "net/url_request/url_request_status.h"
21 #include "net/url_request/url_request_test_util.h" 22 #include "net/url_request/url_request_test_util.h"
22 #include "testing/gmock/include/gmock/gmock.h" 23 #include "testing/gmock/include/gmock/gmock.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 #include "url/gurl.h" 25 #include "url/gurl.h"
25 26
26 using ::testing::_; 27 using ::testing::_;
27 using ::testing::Eq; 28 using ::testing::Eq;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 MockOAuthFetcherFactory() 88 MockOAuthFetcherFactory()
88 : net::ScopedURLFetcherFactory(this), 89 : net::ScopedURLFetcherFactory(this),
89 response_code_(net::HTTP_OK), 90 response_code_(net::HTTP_OK),
90 complete_immediately_(true) { 91 complete_immediately_(true) {
91 } 92 }
92 ~MockOAuthFetcherFactory() override {} 93 ~MockOAuthFetcherFactory() override {}
93 std::unique_ptr<net::URLFetcher> CreateURLFetcher( 94 std::unique_ptr<net::URLFetcher> CreateURLFetcher(
94 int id, 95 int id,
95 const GURL& url, 96 const GURL& url,
96 net::URLFetcher::RequestType request_type, 97 net::URLFetcher::RequestType request_type,
97 net::URLFetcherDelegate* d) override { 98 net::URLFetcherDelegate* d,
99 net::NetworkTrafficAnnotationTag traffic_annotation) override {
98 url_fetcher_ = new MockOAuthFetcher( 100 url_fetcher_ = new MockOAuthFetcher(
99 response_code_, 101 response_code_,
100 max_failure_count_, 102 max_failure_count_,
101 complete_immediately_, 103 complete_immediately_,
102 url, 104 url,
103 results_, 105 results_,
104 request_type, 106 request_type,
105 d); 107 d);
106 return std::unique_ptr<net::URLFetcher>(url_fetcher_); 108 return std::unique_ptr<net::URLFetcher>(url_fetcher_);
107 } 109 }
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 431
430 GaiaOAuthClient auth(GetRequestContext()); 432 GaiaOAuthClient auth(GetRequestContext());
431 auth.GetTokenHandleInfo("some_handle", 1, &delegate); 433 auth.GetTokenHandleInfo("some_handle", 1, &delegate);
432 434
433 std::string audience; 435 std::string audience;
434 ASSERT_TRUE(captured_result->GetString("audience", &audience)); 436 ASSERT_TRUE(captured_result->GetString("audience", &audience));
435 ASSERT_EQ("1234567890.apps.googleusercontent.com", audience); 437 ASSERT_EQ("1234567890.apps.googleusercontent.com", audience);
436 } 438 }
437 439
438 } // namespace gaia 440 } // namespace gaia
OLDNEW
« no previous file with comments | « components/precache/core/precache_fetcher_unittest.cc ('k') | google_apis/gaia/mock_url_fetcher_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698