OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h" | 5 #include "chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 MockWebContents* mock_web_contents = | 256 MockWebContents* mock_web_contents = |
257 static_cast<MockWebContents*>(web_contents()); | 257 static_cast<MockWebContents*>(web_contents()); |
258 mock_web_contents->SetShouldManifestTimeOut(should_time_out); | 258 mock_web_contents->SetShouldManifestTimeOut(should_time_out); |
259 } | 259 } |
260 | 260 |
261 // Registers service worker at |url|. Blocks till the service worker is | 261 // Registers service worker at |url|. Blocks till the service worker is |
262 // registered. | 262 // registered. |
263 void RegisterServiceWorker(const GURL& url) { | 263 void RegisterServiceWorker(const GURL& url) { |
264 base::RunLoop run_loop; | 264 base::RunLoop run_loop; |
265 embedded_worker_test_helper_->context()->RegisterServiceWorker( | 265 embedded_worker_test_helper_->context()->RegisterServiceWorker( |
266 url, GURL(url.spec() + "/service_worker.js"), nullptr, | 266 GURL(url.spec() + "/service_worker.js"), |
| 267 content::ServiceWorkerRegistrationOptions(url), nullptr, |
267 base::Bind(&AddToHomescreenDataFetcherTest::OnServiceWorkerRegistered, | 268 base::Bind(&AddToHomescreenDataFetcherTest::OnServiceWorkerRegistered, |
268 base::Unretained(this), run_loop.QuitClosure())); | 269 base::Unretained(this), run_loop.QuitClosure())); |
269 } | 270 } |
270 | 271 |
271 private: | 272 private: |
272 // Callback for RegisterServiceWorker() for when service worker registration | 273 // Callback for RegisterServiceWorker() for when service worker registration |
273 // has completed. | 274 // has completed. |
274 void OnServiceWorkerRegistered(const base::Closure& callback, | 275 void OnServiceWorkerRegistered(const base::Closure& callback, |
275 content::ServiceWorkerStatusCode status, | 276 content::ServiceWorkerStatusCode status, |
276 const std::string& status_message, | 277 const std::string& status_message, |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 EXPECT_TRUE(base::EqualsASCII(waiter.title(), kDefaultManifestShortName)); | 463 EXPECT_TRUE(base::EqualsASCII(waiter.title(), kDefaultManifestShortName)); |
463 EXPECT_TRUE(base::EqualsASCII(fetcher->shortcut_info().user_title, | 464 EXPECT_TRUE(base::EqualsASCII(fetcher->shortcut_info().user_title, |
464 kDefaultManifestShortName)); | 465 kDefaultManifestShortName)); |
465 | 466 |
466 fetcher->set_weak_observer(nullptr); | 467 fetcher->set_weak_observer(nullptr); |
467 } | 468 } |
468 | 469 |
469 INSTANTIATE_TEST_CASE_P(CheckWebApkCompatibility, | 470 INSTANTIATE_TEST_CASE_P(CheckWebApkCompatibility, |
470 AddToHomescreenDataFetcherTestCommon, | 471 AddToHomescreenDataFetcherTestCommon, |
471 ::testing::Values(false, true)); | 472 ::testing::Values(false, true)); |
OLD | NEW |