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" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
16 #include "base/strings/nullable_string16.h" | 16 #include "base/strings/nullable_string16.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "chrome/browser/installable/installable_manager.h" |
20 #include "chrome/common/web_application_info.h" | 21 #include "chrome/common/web_application_info.h" |
21 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 22 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
22 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
23 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 24 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
24 #include "content/browser/service_worker/service_worker_context_core.h" | 25 #include "content/browser/service_worker/service_worker_context_core.h" |
25 #include "content/common/service_worker/service_worker_status_code.h" | 26 #include "content/common/service_worker/service_worker_status_code.h" |
26 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
27 #include "content/public/browser/site_instance.h" | 28 #include "content/public/browser/site_instance.h" |
28 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
29 #include "content/public/common/manifest.h" | 30 #include "content/public/common/manifest.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 190 |
190 embedded_worker_test_helper_.reset( | 191 embedded_worker_test_helper_.reset( |
191 new content::EmbeddedWorkerTestHelper(base::FilePath())); | 192 new content::EmbeddedWorkerTestHelper(base::FilePath())); |
192 | 193 |
193 scoped_refptr<content::SiteInstance> site_instance = | 194 scoped_refptr<content::SiteInstance> site_instance = |
194 content::SiteInstance::Create(browser_context()); | 195 content::SiteInstance::Create(browser_context()); |
195 site_instance->GetProcess()->Init(); | 196 site_instance->GetProcess()->Init(); |
196 MockWebContents* mock_web_contents = new MockWebContents(browser_context()); | 197 MockWebContents* mock_web_contents = new MockWebContents(browser_context()); |
197 mock_web_contents->Init(content::WebContents::CreateParams( | 198 mock_web_contents->Init(content::WebContents::CreateParams( |
198 browser_context(), std::move(site_instance))); | 199 browser_context(), std::move(site_instance))); |
| 200 InstallableManager::CreateForWebContents(mock_web_contents); |
199 SetContents(mock_web_contents); | 201 SetContents(mock_web_contents); |
200 } | 202 } |
201 | 203 |
202 void TearDown() override { | 204 void TearDown() override { |
203 embedded_worker_test_helper_.reset(); | 205 embedded_worker_test_helper_.reset(); |
204 ChromeRenderViewHostTestHarness::TearDown(); | 206 ChromeRenderViewHostTestHarness::TearDown(); |
205 } | 207 } |
206 | 208 |
207 scoped_refptr<AddToHomescreenDataFetcher> BuildFetcher( | 209 scoped_refptr<AddToHomescreenDataFetcher> BuildFetcher( |
208 bool check_webapk_compatible, | 210 bool check_webapk_compatible, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 } | 364 } |
363 // This callback enables the text field in the add-to-homescreen dialog. | 365 // This callback enables the text field in the add-to-homescreen dialog. |
364 EXPECT_TRUE(waiter.title_available()); | 366 EXPECT_TRUE(waiter.title_available()); |
365 | 367 |
366 fetcher->set_weak_observer(nullptr); | 368 fetcher->set_weak_observer(nullptr); |
367 } | 369 } |
368 | 370 |
369 INSTANTIATE_TEST_CASE_P(CheckWebApkCompatibility, | 371 INSTANTIATE_TEST_CASE_P(CheckWebApkCompatibility, |
370 AddToHomescreenDataFetcherTestCommon, | 372 AddToHomescreenDataFetcherTestCommon, |
371 ::testing::Values(false, true)); | 373 ::testing::Values(false, true)); |
OLD | NEW |