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

Unified Diff: content/browser/frame_host/navigation_handle_impl_unittest.cc

Issue 1721813002: Adding DRP specfic UMA for FirstContentfulPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing drp -> data_reduction_proxy Created 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/navigation_handle_impl_unittest.cc
diff --git a/content/browser/frame_host/navigation_handle_impl_unittest.cc b/content/browser/frame_host/navigation_handle_impl_unittest.cc
index 7776eacaeb3c59c4ac703d139894607b1471957b..550f000cbc8db7b2122d7d02ab17db902aad0594 100644
--- a/content/browser/frame_host/navigation_handle_impl_unittest.cc
+++ b/content/browser/frame_host/navigation_handle_impl_unittest.cc
@@ -1,16 +1,20 @@
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
+
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "content/browser/frame_host/navigation_handle_impl.h"
+#include "content/public/browser/navigation_data.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/test/test_render_frame_host.h"
namespace content {
// Test version of a NavigationThrottle. It will always return the current
// NavigationThrottle::ThrottleCheckResult |result_|, It also monitors the
// number of times WillStartRequest, WillRedirectRequest, and
// WillProcessResponse were called.
class TestNavigationThrottle : public NavigationThrottle {
@@ -49,20 +53,29 @@ class TestNavigationThrottle : public NavigationThrottle {
private:
// The result returned by the TestNavigationThrottle.
NavigationThrottle::ThrottleCheckResult result_;
// The number of times each handler was called.
int will_start_calls_;
int will_redirect_calls_;
int will_process_response_calls_;
};
+class TestNavigationData : public NavigationData {
+ public:
+ TestNavigationData() {}
+ ~TestNavigationData() override {}
+ std::unique_ptr<NavigationData> Clone() const override {
+ return base::WrapUnique(new TestNavigationData());
+ }
+};
+
class NavigationHandleImplTest : public RenderViewHostImplTestHarness {
public:
NavigationHandleImplTest()
: was_callback_called_(false),
callback_result_(NavigationThrottle::DEFER) {}
void SetUp() override {
RenderViewHostImplTestHarness::SetUp();
test_handle_ =
NavigationHandleImpl::Create(GURL(), main_test_rfh()->frame_tree_node(),
@@ -638,11 +651,17 @@ TEST_F(NavigationHandleImplTest, CancelThenProceedWillProcessResponse) {
EXPECT_TRUE(was_callback_called());
EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, callback_result());
EXPECT_EQ(0, cancel_throttle->will_start_calls());
EXPECT_EQ(0, cancel_throttle->will_redirect_calls());
EXPECT_EQ(1, cancel_throttle->will_process_response_calls());
EXPECT_EQ(0, proceed_throttle->will_start_calls());
EXPECT_EQ(0, proceed_throttle->will_redirect_calls());
EXPECT_EQ(0, proceed_throttle->will_process_response_calls());
}
+TEST_F(NavigationHandleImplTest, NavigationData) {
+ TestNavigationData* test_data = new TestNavigationData();
+ test_handle()->SetNavigationData(base::WrapUnique(test_data));
+ EXPECT_EQ(test_data, test_handle()->GetNavigationData());
nasko 2016/05/02 22:02:49 This test case doesn't test much, what's the goal
RyanSturm 2016/05/02 23:02:56 I like to unittest everything individually, but th
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698