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

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

Issue 2494333002: Replace wrapUnique(new T(args)) by makeUnique<T>(args) in Blink (Closed)
Patch Set: Drop redundant WTF:: Created 4 years, 1 month 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 // The basis for security checks. 167 // The basis for security checks.
168 m_page->document().setSecurityOrigin(SecurityOrigin::createFromString(url)); 168 m_page->document().setSecurityOrigin(SecurityOrigin::createFromString(url));
169 } 169 }
170 170
171 void testRegisterRejected(const String& scriptURL, 171 void testRegisterRejected(const String& scriptURL,
172 const String& scope, 172 const String& scope,
173 const ScriptValueTest& valueTest) { 173 const ScriptValueTest& valueTest) {
174 // When the registration is rejected, a register call must not reach 174 // When the registration is rejected, a register call must not reach
175 // the provider. 175 // the provider.
176 provide(wrapUnique(new NotReachedWebServiceWorkerProvider())); 176 provide(makeUnique<NotReachedWebServiceWorkerProvider>());
177 177
178 ServiceWorkerContainer* container = 178 ServiceWorkerContainer* container =
179 ServiceWorkerContainer::create(getExecutionContext()); 179 ServiceWorkerContainer::create(getExecutionContext());
180 ScriptState::Scope scriptScope(getScriptState()); 180 ScriptState::Scope scriptScope(getScriptState());
181 RegistrationOptions options; 181 RegistrationOptions options;
182 options.setScope(scope); 182 options.setScope(scope);
183 ScriptPromise promise = 183 ScriptPromise promise =
184 container->registerServiceWorker(getScriptState(), scriptURL, options); 184 container->registerServiceWorker(getScriptState(), scriptURL, options);
185 expectRejected(getScriptState(), promise, valueTest); 185 expectRejected(getScriptState(), promise, valueTest);
186 } 186 }
187 187
188 void testGetRegistrationRejected(const String& documentURL, 188 void testGetRegistrationRejected(const String& documentURL,
189 const ScriptValueTest& valueTest) { 189 const ScriptValueTest& valueTest) {
190 provide(wrapUnique(new NotReachedWebServiceWorkerProvider())); 190 provide(makeUnique<NotReachedWebServiceWorkerProvider>());
191 191
192 ServiceWorkerContainer* container = 192 ServiceWorkerContainer* container =
193 ServiceWorkerContainer::create(getExecutionContext()); 193 ServiceWorkerContainer::create(getExecutionContext());
194 ScriptState::Scope scriptScope(getScriptState()); 194 ScriptState::Scope scriptScope(getScriptState());
195 ScriptPromise promise = 195 ScriptPromise promise =
196 container->getRegistration(getScriptState(), documentURL); 196 container->getRegistration(getScriptState(), documentURL);
197 expectRejected(getScriptState(), promise, valueTest); 197 expectRejected(getScriptState(), promise, valueTest);
198 } 198 }
199 199
200 private: 200 private:
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 ScriptState::Scope scriptScope(getScriptState()); 361 ScriptState::Scope scriptScope(getScriptState());
362 container->getRegistration(getScriptState(), ""); 362 container->getRegistration(getScriptState(), "");
363 EXPECT_EQ(1ul, stubProvider.getRegistrationCallCount()); 363 EXPECT_EQ(1ul, stubProvider.getRegistrationCallCount());
364 EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/index.html")), 364 EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/index.html")),
365 stubProvider.getRegistrationURL()); 365 stubProvider.getRegistrationURL());
366 } 366 }
367 } 367 }
368 368
369 } // namespace 369 } // namespace
370 } // namespace blink 370 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698