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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... Created 4 years 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 1
2 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 #include "modules/serviceworkers/ServiceWorkerContainer.h" 6 #include "modules/serviceworkers/ServiceWorkerContainer.h"
7 7
8 #include "bindings/core/v8/Dictionary.h" 8 #include "bindings/core/v8/Dictionary.h"
9 #include "bindings/core/v8/ScriptFunction.h" 9 #include "bindings/core/v8/ScriptFunction.h"
10 #include "bindings/core/v8/ScriptPromise.h" 10 #include "bindings/core/v8/ScriptPromise.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 // The basis for security checks. 168 // The basis for security checks.
169 m_page->document().setSecurityOrigin(SecurityOrigin::createFromString(url)); 169 m_page->document().setSecurityOrigin(SecurityOrigin::createFromString(url));
170 } 170 }
171 171
172 void testRegisterRejected(const String& scriptURL, 172 void testRegisterRejected(const String& scriptURL,
173 const String& scope, 173 const String& scope,
174 const ScriptValueTest& valueTest) { 174 const ScriptValueTest& valueTest) {
175 // When the registration is rejected, a register call must not reach 175 // When the registration is rejected, a register call must not reach
176 // the provider. 176 // the provider.
177 provide(makeUnique<NotReachedWebServiceWorkerProvider>()); 177 provide(WTF::makeUnique<NotReachedWebServiceWorkerProvider>());
178 178
179 ServiceWorkerContainer* container = 179 ServiceWorkerContainer* container =
180 ServiceWorkerContainer::create(getExecutionContext()); 180 ServiceWorkerContainer::create(getExecutionContext());
181 ScriptState::Scope scriptScope(getScriptState()); 181 ScriptState::Scope scriptScope(getScriptState());
182 RegistrationOptions options; 182 RegistrationOptions options;
183 options.setScope(scope); 183 options.setScope(scope);
184 ScriptPromise promise = 184 ScriptPromise promise =
185 container->registerServiceWorker(getScriptState(), scriptURL, options); 185 container->registerServiceWorker(getScriptState(), scriptURL, options);
186 expectRejected(getScriptState(), promise, valueTest); 186 expectRejected(getScriptState(), promise, valueTest);
187 } 187 }
188 188
189 void testGetRegistrationRejected(const String& documentURL, 189 void testGetRegistrationRejected(const String& documentURL,
190 const ScriptValueTest& valueTest) { 190 const ScriptValueTest& valueTest) {
191 provide(makeUnique<NotReachedWebServiceWorkerProvider>()); 191 provide(WTF::makeUnique<NotReachedWebServiceWorkerProvider>());
192 192
193 ServiceWorkerContainer* container = 193 ServiceWorkerContainer* container =
194 ServiceWorkerContainer::create(getExecutionContext()); 194 ServiceWorkerContainer::create(getExecutionContext());
195 ScriptState::Scope scriptScope(getScriptState()); 195 ScriptState::Scope scriptScope(getScriptState());
196 ScriptPromise promise = 196 ScriptPromise promise =
197 container->getRegistration(getScriptState(), documentURL); 197 container->getRegistration(getScriptState(), documentURL);
198 expectRejected(getScriptState(), promise, valueTest); 198 expectRejected(getScriptState(), promise, valueTest);
199 } 199 }
200 200
201 private: 201 private:
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 class StubWebServiceWorkerProvider { 258 class StubWebServiceWorkerProvider {
259 public: 259 public:
260 StubWebServiceWorkerProvider() 260 StubWebServiceWorkerProvider()
261 : m_registerCallCount(0), m_getRegistrationCallCount(0) {} 261 : m_registerCallCount(0), m_getRegistrationCallCount(0) {}
262 262
263 // Creates a WebServiceWorkerProvider. This can outlive the 263 // Creates a WebServiceWorkerProvider. This can outlive the
264 // StubWebServiceWorkerProvider, but |registerServiceWorker| and 264 // StubWebServiceWorkerProvider, but |registerServiceWorker| and
265 // other methods must not be called after the 265 // other methods must not be called after the
266 // StubWebServiceWorkerProvider dies. 266 // StubWebServiceWorkerProvider dies.
267 std::unique_ptr<WebServiceWorkerProvider> provider() { 267 std::unique_ptr<WebServiceWorkerProvider> provider() {
268 return wrapUnique(new WebServiceWorkerProviderImpl(*this)); 268 return WTF::wrapUnique(new WebServiceWorkerProviderImpl(*this));
269 } 269 }
270 270
271 size_t registerCallCount() { return m_registerCallCount; } 271 size_t registerCallCount() { return m_registerCallCount; }
272 const WebURL& registerScope() { return m_registerScope; } 272 const WebURL& registerScope() { return m_registerScope; }
273 const WebURL& registerScriptURL() { return m_registerScriptURL; } 273 const WebURL& registerScriptURL() { return m_registerScriptURL; }
274 size_t getRegistrationCallCount() { return m_getRegistrationCallCount; } 274 size_t getRegistrationCallCount() { return m_getRegistrationCallCount; }
275 const WebURL& getRegistrationURL() { return m_getRegistrationURL; } 275 const WebURL& getRegistrationURL() { return m_getRegistrationURL; }
276 276
277 private: 277 private:
278 class WebServiceWorkerProviderImpl : public WebServiceWorkerProvider { 278 class WebServiceWorkerProviderImpl : public WebServiceWorkerProvider {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 ScriptState::Scope scriptScope(getScriptState()); 364 ScriptState::Scope scriptScope(getScriptState());
365 container->getRegistration(getScriptState(), ""); 365 container->getRegistration(getScriptState(), "");
366 EXPECT_EQ(1ul, stubProvider.getRegistrationCallCount()); 366 EXPECT_EQ(1ul, stubProvider.getRegistrationCallCount());
367 EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/index.html")), 367 EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/index.html")),
368 stubProvider.getRegistrationURL()); 368 stubProvider.getRegistrationURL());
369 } 369 }
370 } 370 }
371 371
372 } // namespace 372 } // namespace
373 } // namespace blink 373 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698