| Index: Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp
|
| diff --git a/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp b/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp
|
| index bf4ac0e0ec5a358ef0053c08a762c61d63eed602..1ed230de133769b23a726d6cf8db6f172acfca46 100644
|
| --- a/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp
|
| +++ b/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp
|
| @@ -14,10 +14,12 @@
|
| #include "core/dom/DOMException.h"
|
| #include "core/dom/Document.h"
|
| #include "core/dom/ExecutionContext.h"
|
| +#include "core/page/FocusController.h"
|
| #include "core/testing/DummyPageHolder.h"
|
| #include "modules/serviceworkers/ServiceWorkerContainerClient.h"
|
| #include "platform/weborigin/KURL.h"
|
| #include "platform/weborigin/SecurityOrigin.h"
|
| +#include "public/platform/WebServiceWorkerClientsInfo.h"
|
| #include "public/platform/WebServiceWorkerProvider.h"
|
| #include "public/platform/WebURL.h"
|
| #include "wtf/OwnPtr.h"
|
| @@ -163,12 +165,23 @@ protected:
|
| void setPageURL(const String& url)
|
| {
|
| // For URL completion.
|
| - m_page->document().setBaseURLOverride(KURL(KURL(), url));
|
| + m_page->document().setURL(KURL(KURL(), url));
|
|
|
| // The basis for security checks.
|
| m_page->document().setSecurityOrigin(SecurityOrigin::createFromString(url));
|
| }
|
|
|
| + void setVisibilityState(PageVisibilityState visibilityState)
|
| + {
|
| + m_page->page().setVisibilityState(visibilityState, true); // Set as initial state
|
| + }
|
| +
|
| + void setFocused(bool focused)
|
| + {
|
| + m_page->page().focusController().setActive(focused);
|
| + m_page->page().focusController().setFocused(focused);
|
| + }
|
| +
|
| void testRegisterRejected(const String& scriptURL, const String& scope, const ScriptValueTest& valueTest)
|
| {
|
| // When the registration is rejected, a register call must not reach
|
| @@ -358,5 +371,21 @@ TEST_F(ServiceWorkerContainerTest, GetRegistration_OmittedDocumentURLDefaultsToP
|
| container->willBeDetachedFromFrame();
|
| }
|
|
|
| +TEST_F(ServiceWorkerContainerTest, GetClientInfo)
|
| +{
|
| + setVisibilityState(PageVisibilityStateVisible);
|
| + setFocused(true);
|
| + setPageURL("http://localhost/x/index.html");
|
| +
|
| + ServiceWorkerContainer* container = ServiceWorkerContainer::create(executionContext());
|
| +
|
| + WebServiceWorkerClientInfo info;
|
| + ASSERT_TRUE(container->getClientInfo(&info));
|
| + EXPECT_EQ(WebString("visible"), info.visibilityState);
|
| + EXPECT_TRUE(info.focused);
|
| + EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/index.html")), info.url);
|
| + EXPECT_EQ(WebURLRequest::FrameTypeTopLevel, info.frameType);
|
| +}
|
| +
|
| } // namespace
|
| } // namespace blink
|
|
|