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

Unified Diff: Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp

Issue 540823003: ServiceWorker: Implement navigator.serviceWorker.getRegistration [3/3] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: patch for review Created 6 years, 3 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: Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp b/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp
index 73ef62c4c7fb035684857ff1acfadc06217a62d6..d2bb06dcb441017ab584ca4a85e0427bde80c7d3 100644
--- a/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp
+++ b/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp
@@ -205,6 +205,18 @@ protected:
container->willBeDetachedFromFrame();
}
+ void testGetRegistrationRejected(const String& documentURL, const ScriptValueTest& valueTest)
+ {
+ provide(adoptPtr(new NotReachedWebServiceWorkerProvider()));
+
+ ServiceWorkerContainer* container = ServiceWorkerContainer::create(executionContext());
+ ScriptState::Scope scriptScope(scriptState());
+ ScriptPromise promise = container->getRegistration(scriptState(), documentURL);
+ expectRejected(scriptState(), promise, valueTest);
+
+ container->willBeDetachedFromFrame();
+ }
+
private:
OwnPtr<DummyPageHolder> m_page;
};
@@ -252,6 +264,14 @@ TEST_F(ServiceWorkerContainerTest, Unregister_CrossOriginScopeIsRejected)
ExpectDOMException("SecurityError", "The scope must match the current origin."));
}
+TEST_F(ServiceWorkerContainerTest, GetRegistration_NonSecureOriginIsRejected)
+{
+ setPageURL("http://www.example.com/");
+ testGetRegistrationRejected(
+ "http://www.example.com/",
+ ExpectDOMException("NotSupportedError", "Only secure origins are allowed. http://goo.gl/lq4gCo"));
+}
+
nhiroki 2014/09/10 07:45:04 Can you test the CrossOriginDocument case?
Kunihiko Sakamoto 2014/09/10 09:34:51 Done.
class StubWebServiceWorkerProvider {
public:
StubWebServiceWorkerProvider()

Powered by Google App Engine
This is Rietveld 408576698