| Index: chrome/browser/push_messaging/push_messaging_browsertest.cc
|
| diff --git a/chrome/browser/push_messaging/push_messaging_browsertest.cc b/chrome/browser/push_messaging/push_messaging_browsertest.cc
|
| index 313e28fd3051ba31def1f701b1510ac349e88f10..731be3032a2e0944d854e1ee8add00072724e0fb 100644
|
| --- a/chrome/browser/push_messaging/push_messaging_browsertest.cc
|
| +++ b/chrome/browser/push_messaging/push_messaging_browsertest.cc
|
| @@ -88,11 +88,9 @@ class PushMessagingBrowserTest : public InProcessBrowserTest {
|
|
|
| // InProcessBrowserTest:
|
| void SetUp() override {
|
| - https_server_.reset(new net::SpawnedTestServer(
|
| - net::SpawnedTestServer::TYPE_HTTPS,
|
| - net::BaseTestServer::SSLOptions(
|
| - net::BaseTestServer::SSLOptions::CERT_OK),
|
| - base::FilePath(FILE_PATH_LITERAL("chrome/test/data/"))));
|
| + https_server_.reset(
|
| + new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS));
|
| + https_server_->ServeFilesFromSourceDirectory("chrome/test/data");
|
| ASSERT_TRUE(https_server_->Start());
|
|
|
| #if defined(ENABLE_NOTIFICATIONS)
|
| @@ -185,7 +183,7 @@ class PushMessagingBrowserTest : public InProcessBrowserTest {
|
| const PushMessagingAppIdentifier& app_identifier,
|
| const gcm::IncomingMessage& message);
|
|
|
| - net::SpawnedTestServer* https_server() const { return https_server_.get(); }
|
| + net::EmbeddedTestServer* https_server() const { return https_server_.get(); }
|
|
|
| gcm::FakeGCMProfileService* gcm_service() const { return gcm_service_; }
|
|
|
| @@ -214,14 +212,12 @@ class PushMessagingBrowserTest : public InProcessBrowserTest {
|
| PushMessagingServiceImpl* push_service() const { return push_service_; }
|
|
|
| protected:
|
| - virtual std::string GetTestURL() {
|
| - return "files/push_messaging/test.html";
|
| - }
|
| + virtual std::string GetTestURL() { return "/push_messaging/test.html"; }
|
|
|
| virtual Browser* GetBrowser() const { return browser(); }
|
|
|
| private:
|
| - scoped_ptr<net::SpawnedTestServer> https_server_;
|
| + scoped_ptr<net::EmbeddedTestServer> https_server_;
|
| gcm::FakeGCMProfileService* gcm_service_;
|
| PushMessagingServiceImpl* push_service_;
|
|
|
| @@ -235,7 +231,7 @@ class PushMessagingBrowserTest : public InProcessBrowserTest {
|
| class PushMessagingBrowserTestEmptySubscriptionOptions
|
| : public PushMessagingBrowserTest {
|
| std::string GetTestURL() override {
|
| - return "files/push_messaging/test_no_subscription_options.html";
|
| + return "/push_messaging/test_no_subscription_options.html";
|
| }
|
| };
|
|
|
| @@ -272,7 +268,7 @@ void PushMessagingBrowserTest::TryToSubscribeSuccessfully(
|
| PushMessagingAppIdentifier
|
| PushMessagingBrowserTest::GetAppIdentifierForServiceWorkerRegistration(
|
| int64 service_worker_registration_id) {
|
| - GURL origin = https_server()->GetURL(std::string()).GetOrigin();
|
| + GURL origin = https_server()->GetURL("/").GetOrigin();
|
| PushMessagingAppIdentifier app_identifier =
|
| PushMessagingAppIdentifier::FindByServiceWorker(
|
| GetBrowser()->profile(), origin, service_worker_registration_id);
|
| @@ -376,24 +372,24 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribePersisted) {
|
| GetAppIdentifierForServiceWorkerRegistration(0LL);
|
| EXPECT_EQ(sw0_identifier.app_id(), gcm_service()->last_registered_app_id());
|
|
|
| - LoadTestPage("files/push_messaging/subscope1/test.html");
|
| + LoadTestPage("/push_messaging/subscope1/test.html");
|
| ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
|
| ASSERT_EQ("ok - service worker registered", script_result);
|
|
|
| - LoadTestPage("files/push_messaging/subscope2/test.html");
|
| + LoadTestPage("/push_messaging/subscope2/test.html");
|
| ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
|
| ASSERT_EQ("ok - service worker registered", script_result);
|
|
|
| // Note that we need to reload the page after registering, otherwise
|
| // navigator.serviceWorker.ready is going to be resolved with the parent
|
| // Service Worker which still controls the page.
|
| - LoadTestPage("files/push_messaging/subscope2/test.html");
|
| + LoadTestPage("/push_messaging/subscope2/test.html");
|
| TryToSubscribeSuccessfully("1-1" /* expected_push_subscription_id */);
|
| PushMessagingAppIdentifier sw2_identifier =
|
| GetAppIdentifierForServiceWorkerRegistration(2LL);
|
| EXPECT_EQ(sw2_identifier.app_id(), gcm_service()->last_registered_app_id());
|
|
|
| - LoadTestPage("files/push_messaging/subscope1/test.html");
|
| + LoadTestPage("/push_messaging/subscope1/test.html");
|
| TryToSubscribeSuccessfully("1-2" /* expected_push_subscription_id */);
|
| PushMessagingAppIdentifier sw1_identifier =
|
| GetAppIdentifierForServiceWorkerRegistration(1LL);
|
| @@ -407,11 +403,11 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribePersisted) {
|
| // test server uses random port numbers for each test (even PRE_Foo and Foo),
|
| // so we wouldn't be able to load the test pages with the same origin.
|
|
|
| - LoadTestPage("files/push_messaging/subscope1/test.html");
|
| + LoadTestPage("/push_messaging/subscope1/test.html");
|
| TryToSubscribeSuccessfully("1-2" /* expected_push_subscription_id */);
|
| EXPECT_EQ(sw1_identifier.app_id(), gcm_service()->last_registered_app_id());
|
|
|
| - LoadTestPage("files/push_messaging/subscope2/test.html");
|
| + LoadTestPage("/push_messaging/subscope2/test.html");
|
| TryToSubscribeSuccessfully("1-1" /* expected_push_subscription_id */);
|
| EXPECT_EQ(sw1_identifier.app_id(), gcm_service()->last_registered_app_id());
|
|
|
| @@ -850,7 +846,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
|
| push_service()->SetContentSettingChangedCallbackForTesting(
|
| message_loop_runner->QuitClosure());
|
|
|
| - GURL origin = https_server()->GetURL(std::string()).GetOrigin();
|
| + GURL origin = https_server()->GetURL("/").GetOrigin();
|
| HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile())
|
| ->SetContentSetting(ContentSettingsPattern::FromURLNoWildcard(origin),
|
| ContentSettingsPattern::FromURLNoWildcard(origin),
|
| @@ -884,7 +880,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
|
| push_service()->SetContentSettingChangedCallbackForTesting(
|
| message_loop_runner->QuitClosure());
|
|
|
| - GURL origin = https_server()->GetURL(std::string()).GetOrigin();
|
| + GURL origin = https_server()->GetURL("/").GetOrigin();
|
| HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile())
|
| ->SetContentSetting(ContentSettingsPattern::FromURLNoWildcard(origin),
|
| ContentSettingsPattern::FromURLNoWildcard(origin),
|
| @@ -947,7 +943,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
|
| push_service()->SetContentSettingChangedCallbackForTesting(
|
| message_loop_runner->QuitClosure());
|
|
|
| - GURL origin = https_server()->GetURL(std::string()).GetOrigin();
|
| + GURL origin = https_server()->GetURL("/").GetOrigin();
|
| HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile())
|
| ->SetContentSetting(ContentSettingsPattern::FromURLNoWildcard(origin),
|
| ContentSettingsPattern::Wildcard(),
|
| @@ -981,7 +977,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
|
| push_service()->SetContentSettingChangedCallbackForTesting(
|
| message_loop_runner->QuitClosure());
|
|
|
| - GURL origin = https_server()->GetURL(std::string()).GetOrigin();
|
| + GURL origin = https_server()->GetURL("/").GetOrigin();
|
| HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile())
|
| ->SetContentSetting(ContentSettingsPattern::FromURLNoWildcard(origin),
|
| ContentSettingsPattern::Wildcard(),
|
| @@ -1015,7 +1011,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
|
| push_service()->SetContentSettingChangedCallbackForTesting(
|
| base::BarrierClosure(2, message_loop_runner->QuitClosure()));
|
|
|
| - GURL origin = https_server()->GetURL(std::string()).GetOrigin();
|
| + GURL origin = https_server()->GetURL("/").GetOrigin();
|
| HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile())
|
| ->SetContentSetting(ContentSettingsPattern::FromURLNoWildcard(origin),
|
| ContentSettingsPattern::Wildcard(),
|
| @@ -1059,7 +1055,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
|
| push_service()->SetContentSettingChangedCallbackForTesting(
|
| base::BarrierClosure(4, message_loop_runner->QuitClosure()));
|
|
|
| - GURL origin = https_server()->GetURL(std::string()).GetOrigin();
|
| + GURL origin = https_server()->GetURL("/").GetOrigin();
|
| HostContentSettingsMapFactory::GetForProfile(GetBrowser()->profile())
|
| ->SetContentSetting(ContentSettingsPattern::Wildcard(),
|
| ContentSettingsPattern::Wildcard(),
|
|
|