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

Side by Side Diff: content/test/test_navigation_url_loader_delegate.cc

Issue 1721813002: Adding DRP specfic UMA for FirstContentfulPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "content/test/test_navigation_url_loader_delegate.h" 5 #include "content/test/test_navigation_url_loader_delegate.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "content/public/browser/navigation_data.h"
8 #include "content/public/browser/stream_handle.h" 9 #include "content/public/browser/stream_handle.h"
9 #include "content/public/common/resource_response.h" 10 #include "content/public/common/resource_response.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 namespace content { 13 namespace content {
13 14
14 TestNavigationURLLoaderDelegate::TestNavigationURLLoaderDelegate() 15 TestNavigationURLLoaderDelegate::TestNavigationURLLoaderDelegate()
15 : net_error_(0), on_request_handled_counter_(0) {} 16 : net_error_(0), on_request_handled_counter_(0) {}
16 17
17 TestNavigationURLLoaderDelegate::~TestNavigationURLLoaderDelegate() {} 18 TestNavigationURLLoaderDelegate::~TestNavigationURLLoaderDelegate() {}
(...skipping 30 matching lines...) Expand all
48 const net::RedirectInfo& redirect_info, 49 const net::RedirectInfo& redirect_info,
49 const scoped_refptr<ResourceResponse>& response) { 50 const scoped_refptr<ResourceResponse>& response) {
50 redirect_info_ = redirect_info; 51 redirect_info_ = redirect_info;
51 redirect_response_ = response; 52 redirect_response_ = response;
52 ASSERT_TRUE(request_redirected_); 53 ASSERT_TRUE(request_redirected_);
53 request_redirected_->Quit(); 54 request_redirected_->Quit();
54 } 55 }
55 56
56 void TestNavigationURLLoaderDelegate::OnResponseStarted( 57 void TestNavigationURLLoaderDelegate::OnResponseStarted(
57 const scoped_refptr<ResourceResponse>& response, 58 const scoped_refptr<ResourceResponse>& response,
58 std::unique_ptr<StreamHandle> body) { 59 std::unique_ptr<StreamHandle> body,
60 std::unique_ptr<NavigationData> navigation_data) {
59 response_ = response; 61 response_ = response;
60 body_ = std::move(body); 62 body_ = std::move(body);
61 ASSERT_TRUE(response_started_); 63 ASSERT_TRUE(response_started_);
62 response_started_->Quit(); 64 response_started_->Quit();
63 } 65 }
64 66
65 void TestNavigationURLLoaderDelegate::OnRequestFailed(bool in_cache, 67 void TestNavigationURLLoaderDelegate::OnRequestFailed(bool in_cache,
66 int net_error) { 68 int net_error) {
67 net_error_ = net_error; 69 net_error_ = net_error;
68 if (request_failed_) 70 if (request_failed_)
69 request_failed_->Quit(); 71 request_failed_->Quit();
70 } 72 }
71 73
72 void TestNavigationURLLoaderDelegate::OnRequestStarted( 74 void TestNavigationURLLoaderDelegate::OnRequestStarted(
73 base::TimeTicks timestamp) { 75 base::TimeTicks timestamp) {
74 ASSERT_FALSE(timestamp.is_null()); 76 ASSERT_FALSE(timestamp.is_null());
75 ++on_request_handled_counter_; 77 ++on_request_handled_counter_;
76 if (request_started_) 78 if (request_started_)
77 request_started_->Quit(); 79 request_started_->Quit();
78 } 80 }
79 81
80 } // namespace content 82 } // namespace content
OLDNEW
« no previous file with comments | « content/test/test_navigation_url_loader_delegate.h ('k') | content/test/test_render_frame_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698