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

Unified Diff: third_party/WebKit/Source/core/timing/PerformanceBaseTest.cpp

Issue 2647643004: Report nav timing 2 instance as soon as it's requested. (Closed)
Patch Set: add TODO Created 3 years, 9 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: third_party/WebKit/Source/core/timing/PerformanceBaseTest.cpp
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBaseTest.cpp b/third_party/WebKit/Source/core/timing/PerformanceBaseTest.cpp
index b217ed07b92008e39e7298fcd5a0027cb5892f6a..932c3df4fc9dcb0b0885bbf822afea704dce77ef 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceBaseTest.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceBaseTest.cpp
@@ -62,12 +62,6 @@ class PerformanceBaseTest : public ::testing::Test {
return m_observer->m_performanceEntries.size();
}
- PerformanceNavigationTiming::NavigationType getNavigationType(
- NavigationType type,
- Document* document) {
- return PerformanceBase::getNavigationType(type, document);
- }
-
static bool allowsTimingRedirect(
const Vector<ResourceResponse>& redirectChain,
const ResourceResponse& finalResponse,
@@ -148,19 +142,20 @@ TEST_F(PerformanceBaseTest, AddLongTaskTiming) {
TEST_F(PerformanceBaseTest, GetNavigationType) {
m_pageHolder->page().setVisibilityState(PageVisibilityStatePrerender, false);
PerformanceNavigationTiming::NavigationType returnedType =
- getNavigationType(NavigationTypeBackForward, &m_pageHolder->document());
+ PerformanceBase::getNavigationType(NavigationTypeBackForward,
+ &m_pageHolder->document());
EXPECT_EQ(returnedType,
PerformanceNavigationTiming::NavigationType::Prerender);
m_pageHolder->page().setVisibilityState(PageVisibilityStateHidden, false);
- returnedType =
- getNavigationType(NavigationTypeBackForward, &m_pageHolder->document());
+ returnedType = PerformanceBase::getNavigationType(NavigationTypeBackForward,
+ &m_pageHolder->document());
EXPECT_EQ(returnedType,
PerformanceNavigationTiming::NavigationType::BackForward);
m_pageHolder->page().setVisibilityState(PageVisibilityStateVisible, false);
- returnedType = getNavigationType(NavigationTypeFormResubmitted,
- &m_pageHolder->document());
+ returnedType = PerformanceBase::getNavigationType(
+ NavigationTypeFormResubmitted, &m_pageHolder->document());
EXPECT_EQ(returnedType,
PerformanceNavigationTiming::NavigationType::Navigate);
}
@@ -171,7 +166,6 @@ TEST_F(PerformanceBaseTest, AllowsTimingRedirect) {
Vector<ResourceResponse> redirectChain;
KURL url(ParsedURLString, originDomain + "/foo.html");
ResourceResponse finalResponse;
- finalResponse.setURL(url);
ResourceResponse redirectResponse1;
redirectResponse1.setURL(url);
ResourceResponse redirectResponse2;
@@ -179,6 +173,11 @@ TEST_F(PerformanceBaseTest, AllowsTimingRedirect) {
redirectChain.push_back(redirectResponse1);
redirectChain.push_back(redirectResponse2);
RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(url);
+ // When finalResponse is an empty object.
+ EXPECT_FALSE(allowsTimingRedirect(redirectChain, finalResponse,
+ *securityOrigin.get(),
+ getExecutionContext()));
+ finalResponse.setURL(url);
EXPECT_TRUE(allowsTimingRedirect(redirectChain, finalResponse,
*securityOrigin.get(),
getExecutionContext()));
« no previous file with comments | « third_party/WebKit/Source/core/timing/PerformanceBase.cpp ('k') | third_party/WebKit/Source/core/timing/PerformanceEntry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698