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

Side by Side Diff: third_party/WebKit/Source/core/timing/PerformanceBaseTest.cpp

Issue 2617783002: Migrate WTF::Vector::append() to ::push_back() [part 12 of N] (Closed)
Patch Set: rebase Created 3 years, 11 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 "core/timing/Performance.h" 5 #include "core/timing/Performance.h"
6 6
7 #include "bindings/core/v8/PerformanceObserverCallback.h" 7 #include "bindings/core/v8/PerformanceObserverCallback.h"
8 #include "bindings/core/v8/V8BindingForTesting.h" 8 #include "bindings/core/v8/V8BindingForTesting.h"
9 #include "core/testing/DummyPageHolder.h" 9 #include "core/testing/DummyPageHolder.h"
10 #include "core/testing/NullExecutionContext.h" 10 #include "core/testing/NullExecutionContext.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // Add a long task entry, but no observer registered. 122 // Add a long task entry, but no observer registered.
123 m_base->addLongTaskTiming(1234, 5678, "same-origin", "www.foo.com/bar", "", 123 m_base->addLongTaskTiming(1234, 5678, "same-origin", "www.foo.com/bar", "",
124 ""); 124 "");
125 EXPECT_FALSE(m_base->hasPerformanceObserverFor(PerformanceEntry::LongTask)); 125 EXPECT_FALSE(m_base->hasPerformanceObserverFor(PerformanceEntry::LongTask));
126 EXPECT_EQ(0, numPerformanceEntriesInObserver()); // has no effect 126 EXPECT_EQ(0, numPerformanceEntriesInObserver()); // has no effect
127 127
128 // Make an observer for longtask 128 // Make an observer for longtask
129 NonThrowableExceptionState exceptionState; 129 NonThrowableExceptionState exceptionState;
130 PerformanceObserverInit options; 130 PerformanceObserverInit options;
131 Vector<String> entryTypeVec; 131 Vector<String> entryTypeVec;
132 entryTypeVec.append("longtask"); 132 entryTypeVec.push_back("longtask");
133 options.setEntryTypes(entryTypeVec); 133 options.setEntryTypes(entryTypeVec);
134 m_observer->observe(options, exceptionState); 134 m_observer->observe(options, exceptionState);
135 135
136 EXPECT_TRUE(m_base->hasPerformanceObserverFor(PerformanceEntry::LongTask)); 136 EXPECT_TRUE(m_base->hasPerformanceObserverFor(PerformanceEntry::LongTask));
137 // Add a long task entry 137 // Add a long task entry
138 m_base->addLongTaskTiming(1234, 5678, "same-origin", "www.foo.com/bar", "", 138 m_base->addLongTaskTiming(1234, 5678, "same-origin", "www.foo.com/bar", "",
139 ""); 139 "");
140 EXPECT_EQ(1, numPerformanceEntriesInObserver()); // added an entry 140 EXPECT_EQ(1, numPerformanceEntriesInObserver()); // added an entry
141 } 141 }
142 142
(...skipping 21 matching lines...) Expand all
164 // When there are no cross-origin redirects. 164 // When there are no cross-origin redirects.
165 AtomicString originDomain = "http://127.0.0.1:8000"; 165 AtomicString originDomain = "http://127.0.0.1:8000";
166 Vector<ResourceResponse> redirectChain; 166 Vector<ResourceResponse> redirectChain;
167 KURL url(ParsedURLString, originDomain + "/foo.html"); 167 KURL url(ParsedURLString, originDomain + "/foo.html");
168 ResourceResponse finalResponse; 168 ResourceResponse finalResponse;
169 finalResponse.setURL(url); 169 finalResponse.setURL(url);
170 ResourceResponse redirectResponse1; 170 ResourceResponse redirectResponse1;
171 redirectResponse1.setURL(url); 171 redirectResponse1.setURL(url);
172 ResourceResponse redirectResponse2; 172 ResourceResponse redirectResponse2;
173 redirectResponse2.setURL(url); 173 redirectResponse2.setURL(url);
174 redirectChain.append(redirectResponse1); 174 redirectChain.push_back(redirectResponse1);
175 redirectChain.append(redirectResponse2); 175 redirectChain.push_back(redirectResponse2);
176 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(url); 176 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(url);
177 EXPECT_TRUE(allowsTimingRedirect(redirectChain, finalResponse, 177 EXPECT_TRUE(allowsTimingRedirect(redirectChain, finalResponse,
178 *securityOrigin.get(), 178 *securityOrigin.get(),
179 getExecutionContext())); 179 getExecutionContext()));
180 // When there exist cross-origin redirects. 180 // When there exist cross-origin redirects.
181 AtomicString crossOriginDomain = "http://126.0.0.1:8000"; 181 AtomicString crossOriginDomain = "http://126.0.0.1:8000";
182 KURL redirectUrl(ParsedURLString, crossOriginDomain + "/bar.html"); 182 KURL redirectUrl(ParsedURLString, crossOriginDomain + "/bar.html");
183 ResourceResponse redirectResponse3; 183 ResourceResponse redirectResponse3;
184 redirectResponse3.setURL(redirectUrl); 184 redirectResponse3.setURL(redirectUrl);
185 redirectChain.append(redirectResponse3); 185 redirectChain.push_back(redirectResponse3);
186 EXPECT_FALSE(allowsTimingRedirect(redirectChain, finalResponse, 186 EXPECT_FALSE(allowsTimingRedirect(redirectChain, finalResponse,
187 *securityOrigin.get(), 187 *securityOrigin.get(),
188 getExecutionContext())); 188 getExecutionContext()));
189 189
190 // When cross-origin redirect opts in. 190 // When cross-origin redirect opts in.
191 redirectChain.back().setHTTPHeaderField(HTTPNames::Timing_Allow_Origin, 191 redirectChain.back().setHTTPHeaderField(HTTPNames::Timing_Allow_Origin,
192 originDomain); 192 originDomain);
193 EXPECT_TRUE(allowsTimingRedirect(redirectChain, finalResponse, 193 EXPECT_TRUE(allowsTimingRedirect(redirectChain, finalResponse,
194 *securityOrigin.get(), 194 *securityOrigin.get(),
195 getExecutionContext())); 195 getExecutionContext()));
196 } 196 }
197 197
198 } // namespace blink 198 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698