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" | |
11 #include "base/files/file_path.h" | |
12 #include "base/macros.h" | 10 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
14 #include "base/message_loop/message_loop.h" | |
15 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
16 #include "base/strings/nullable_string16.h" | 13 #include "base/strings/nullable_string16.h" |
17 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
18 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
19 #include "base/time/time.h" | |
20 #include "chrome/browser/installable/installable_manager.h" | 16 #include "chrome/browser/installable/installable_manager.h" |
21 #include "chrome/common/web_application_info.h" | 17 #include "chrome/common/web_application_info.h" |
22 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 18 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
23 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
24 #include "content/browser/service_worker/embedded_worker_test_helper.h" | |
25 #include "content/browser/service_worker/service_worker_context_core.h" | |
26 #include "content/common/service_worker/service_worker_status_code.h" | |
27 #include "content/public/browser/browser_thread.h" | |
28 #include "content/public/browser/site_instance.h" | |
29 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
30 #include "content/public/common/manifest.h" | 21 #include "content/public/common/manifest.h" |
31 #include "content/test/test_web_contents.h" | |
32 #include "net/http/http_status_code.h" | |
33 #include "third_party/WebKit/public/platform/WebDisplayMode.h" | 22 #include "third_party/WebKit/public/platform/WebDisplayMode.h" |
34 #include "ui/gfx/image/image_unittest_util.h" | 23 #include "ui/gfx/image/image_unittest_util.h" |
35 #include "url/gurl.h" | 24 #include "url/gurl.h" |
36 | 25 |
37 namespace { | 26 namespace { |
38 | 27 |
39 const char* kWebApplicationInfoTitle = "Meta Title"; | 28 const char* kWebApplicationInfoTitle = "Meta Title"; |
40 const char* kDefaultManifestUrl = "https://www.example.com/manifest.json"; | 29 const char* kDefaultManifestUrl = "https://www.example.com/manifest.json"; |
30 const char* kDefaultIconUrl = "https://www.example.com/icon.png"; | |
41 const char* kDefaultManifestName = "Default Name"; | 31 const char* kDefaultManifestName = "Default Name"; |
42 const char* kDefaultManifestShortName = "Default Short Name"; | 32 const char* kDefaultManifestShortName = "Default Short Name"; |
43 const char* kDefaultStartUrl = "https://www.example.com/index.html"; | 33 const char* kDefaultStartUrl = "https://www.example.com/index.html"; |
44 const blink::WebDisplayMode kDefaultManifestDisplayMode = | 34 const blink::WebDisplayMode kDefaultManifestDisplayMode = |
45 blink::kWebDisplayModeStandalone; | 35 blink::kWebDisplayModeStandalone; |
36 const int kIconSizePx = 144; | |
46 | 37 |
47 // WebContents subclass which mocks out image and manifest fetching. | 38 // Tracks which of the AddToHomescreenDataFetcher::Observer methods have been |
48 class MockWebContents : public content::TestWebContents { | |
49 public: | |
50 explicit MockWebContents(content::BrowserContext* browser_context) | |
51 : content::TestWebContents(browser_context), | |
52 should_image_time_out_(false), | |
53 should_manifest_time_out_(false) {} | |
54 | |
55 ~MockWebContents() override {} | |
56 | |
57 void SetManifest(const GURL& manifest_url, | |
58 const content::Manifest& manifest) { | |
59 manifest_url_ = manifest_url; | |
60 manifest_ = manifest; | |
61 } | |
62 | |
63 int DownloadImage(const GURL& url, | |
64 bool is_favicon, | |
65 uint32_t max_bitmap_size, | |
66 bool bypass_cache, | |
67 const ImageDownloadCallback& callback) override { | |
68 if (should_image_time_out_) | |
69 return 0; | |
70 | |
71 const int kIconSizePx = 144; | |
72 SkBitmap icon = gfx::test::CreateBitmap(kIconSizePx, kIconSizePx); | |
73 std::vector<SkBitmap> icons(1u, icon); | |
74 std::vector<gfx::Size> pixel_sizes(1u, gfx::Size(kIconSizePx, kIconSizePx)); | |
75 content::BrowserThread::GetTaskRunnerForThread(content::BrowserThread::UI) | |
76 ->PostTask(FROM_HERE, base::Bind(callback, 0, net::HTTP_OK, url, icons, | |
77 pixel_sizes)); | |
78 return 0; | |
79 } | |
80 | |
81 void GetManifest(const GetManifestCallback& callback) override { | |
82 if (should_manifest_time_out_) | |
83 return; | |
84 | |
85 content::BrowserThread::GetTaskRunnerForThread(content::BrowserThread::UI) | |
86 ->PostTask(FROM_HERE, base::Bind(callback, manifest_url_, manifest_)); | |
87 } | |
88 | |
89 void SetShouldImageTimeOut(bool should_time_out) { | |
90 should_image_time_out_ = should_time_out; | |
91 } | |
92 | |
93 void SetShouldManifestTimeOut(bool should_time_out) { | |
94 should_manifest_time_out_ = should_time_out; | |
95 } | |
96 | |
97 private: | |
98 GURL manifest_url_; | |
99 content::Manifest manifest_; | |
100 bool should_image_time_out_; | |
101 bool should_manifest_time_out_; | |
102 | |
103 DISALLOW_COPY_AND_ASSIGN(MockWebContents); | |
104 }; | |
105 | |
106 // Tracks which of the AddToHomescreenDataFetcher::Observer callbacks have been | |
107 // called. | 39 // called. |
108 class ObserverWaiter : public AddToHomescreenDataFetcher::Observer { | 40 class ObserverWaiter : public AddToHomescreenDataFetcher::Observer { |
109 public: | 41 public: |
110 ObserverWaiter() | 42 ObserverWaiter() |
111 : is_webapk_compatible_(false), | 43 : is_webapk_compatible_(false), |
112 determined_webapk_compatibility_(false), | 44 determined_webapk_compatibility_(false), |
113 title_available_(false), | 45 title_available_(false), |
114 data_available_(false) {} | 46 data_available_(false) {} |
115 ~ObserverWaiter() override {} | 47 ~ObserverWaiter() override {} |
116 | 48 |
117 // Waits till the OnDataAvailable() callback is called. | 49 // Waits till the OnDataAvailable() callback is called. |
118 void WaitForDataAvailable() { | 50 void WaitForDataAvailable() { |
119 if (data_available_) | 51 if (data_available_) |
120 return; | 52 return; |
121 | 53 |
122 base::RunLoop run_loop; | 54 base::RunLoop run_loop; |
123 quit_closure_ = run_loop.QuitClosure(); | 55 quit_closure_ = run_loop.QuitClosure(); |
124 run_loop.Run(); | 56 run_loop.Run(); |
125 } | 57 } |
126 | 58 |
127 void OnDidDetermineWebApkCompatibility(bool is_webapk_compatible) override { | 59 void OnDidDetermineWebApkCompatibility(bool is_webapk_compatible) override { |
60 // This should only be called once. | |
61 EXPECT_FALSE(determined_webapk_compatibility_); | |
128 EXPECT_FALSE(title_available_); | 62 EXPECT_FALSE(title_available_); |
129 determined_webapk_compatibility_ = true; | 63 determined_webapk_compatibility_ = true; |
130 is_webapk_compatible_ = is_webapk_compatible; | 64 is_webapk_compatible_ = is_webapk_compatible; |
131 } | 65 } |
132 | 66 |
133 void OnUserTitleAvailable(const base::string16& title) override { | 67 void OnUserTitleAvailable(const base::string16& title) override { |
68 // This should only be called once. | |
69 EXPECT_FALSE(title_available_); | |
134 EXPECT_FALSE(data_available_); | 70 EXPECT_FALSE(data_available_); |
135 title_available_ = true; | 71 title_available_ = true; |
136 title_ = title; | 72 title_ = title; |
137 } | 73 } |
138 | 74 |
139 SkBitmap FinalizeLauncherIconInBackground(const SkBitmap& icon, | 75 SkBitmap FinalizeLauncherIconInBackground(const SkBitmap& icon, |
140 const GURL& url, | 76 const GURL& url, |
141 bool* is_generated) override { | 77 bool* is_generated) override { |
142 *is_generated = false; | 78 *is_generated = false; |
143 return icon; | 79 return icon; |
144 } | 80 } |
145 | 81 |
146 void OnDataAvailable(const ShortcutInfo& info, | 82 void OnDataAvailable(const ShortcutInfo& info, |
147 const SkBitmap& primary_icon, | 83 const SkBitmap& primary_icon, |
148 const SkBitmap& badge_icon) override { | 84 const SkBitmap& badge_icon) override { |
85 // This should only be called once. | |
86 EXPECT_FALSE(data_available_); | |
149 EXPECT_TRUE(title_available_); | 87 EXPECT_TRUE(title_available_); |
150 data_available_ = true; | 88 data_available_ = true; |
151 if (!quit_closure_.is_null()) | 89 if (!quit_closure_.is_null()) |
152 quit_closure_.Run(); | 90 quit_closure_.Run(); |
153 } | 91 } |
154 | 92 |
155 base::string16 title() const { return title_; } | 93 base::string16 title() const { return title_; } |
156 bool is_webapk_compatible() const { return is_webapk_compatible_; } | 94 bool is_webapk_compatible() const { return is_webapk_compatible_; } |
157 bool determined_webapk_compatibility() const { | 95 bool determined_webapk_compatibility() const { |
158 return determined_webapk_compatibility_; | 96 return determined_webapk_compatibility_; |
159 } | 97 } |
160 bool title_available() const { return title_available_; } | 98 bool title_available() const { return title_available_; } |
161 | 99 |
162 private: | 100 private: |
163 base::string16 title_; | 101 base::string16 title_; |
164 bool is_webapk_compatible_; | 102 bool is_webapk_compatible_; |
165 bool determined_webapk_compatibility_; | 103 bool determined_webapk_compatibility_; |
166 bool title_available_; | 104 bool title_available_; |
167 bool data_available_; | 105 bool data_available_; |
168 base::Closure quit_closure_; | 106 base::Closure quit_closure_; |
169 | 107 |
170 DISALLOW_COPY_AND_ASSIGN(ObserverWaiter); | 108 DISALLOW_COPY_AND_ASSIGN(ObserverWaiter); |
171 }; | 109 }; |
172 | 110 |
173 // Builds non-null base::NullableString16 from a UTF8 string. | 111 // Builds non-null base::NullableString16 from a UTF8 string. |
174 base::NullableString16 NullableStringFromUTF8(const std::string& value) { | 112 base::NullableString16 NullableStringFromUTF8(const std::string& value) { |
175 return base::NullableString16(base::UTF8ToUTF16(value), false); | 113 return base::NullableString16(base::UTF8ToUTF16(value), false); |
176 } | 114 } |
177 | 115 |
178 content::Manifest BuildEmptyManifest() { | |
179 return content::Manifest(); | |
180 } | |
181 | |
182 // Builds WebAPK compatible content::Manifest. | 116 // Builds WebAPK compatible content::Manifest. |
183 content::Manifest BuildDefaultManifest() { | 117 content::Manifest BuildDefaultManifest() { |
184 content::Manifest manifest; | 118 content::Manifest manifest; |
185 manifest.name = NullableStringFromUTF8(kDefaultManifestName); | 119 manifest.name = NullableStringFromUTF8(kDefaultManifestName); |
186 manifest.short_name = NullableStringFromUTF8(kDefaultManifestShortName); | 120 manifest.short_name = NullableStringFromUTF8(kDefaultManifestShortName); |
187 manifest.start_url = GURL(kDefaultStartUrl); | 121 manifest.start_url = GURL(kDefaultStartUrl); |
188 manifest.display = kDefaultManifestDisplayMode; | 122 manifest.display = kDefaultManifestDisplayMode; |
189 | 123 |
190 content::Manifest::Icon primary_icon; | 124 content::Manifest::Icon primary_icon; |
191 primary_icon.type = base::ASCIIToUTF16("image/png"); | 125 primary_icon.type = base::ASCIIToUTF16("image/png"); |
192 primary_icon.sizes.push_back(gfx::Size(144, 144)); | 126 primary_icon.sizes.push_back(gfx::Size(144, 144)); |
193 primary_icon.purpose.push_back(content::Manifest::Icon::IconPurpose::ANY); | 127 primary_icon.purpose.push_back(content::Manifest::Icon::IconPurpose::ANY); |
194 primary_icon.src = GURL("https://www.google.com/image.png"); | 128 primary_icon.src = GURL(kDefaultIconUrl); |
195 manifest.icons.push_back(primary_icon); | 129 manifest.icons.push_back(primary_icon); |
196 | 130 |
197 return manifest; | 131 return manifest; |
198 } | 132 } |
199 | 133 |
200 } // anonymous namespace | 134 } // anonymous namespace |
201 | 135 |
136 class TestInstallableManager : public InstallableManager { | |
137 public: | |
138 explicit TestInstallableManager(content::WebContents* web_contents) | |
139 : InstallableManager(web_contents) {} | |
140 | |
141 void GetData(const InstallableParams& params, | |
142 const InstallableCallback& callback) override { | |
143 if (should_manifest_time_out_ || | |
144 (params.check_installable && should_installable_time_out_)) { | |
145 return; | |
146 } | |
147 | |
148 InstallableStatusCode code = code_; | |
149 if (params.check_installable) { | |
150 if (!IsManifestValidForWebApp(manifest_)) | |
151 code = valid_manifest_->error; | |
152 else if (!is_installable_) | |
153 code = NO_MATCHING_SERVICE_WORKER; | |
154 } | |
155 | |
156 callback.Run( | |
157 {code, GURL(kDefaultManifestUrl), manifest_, | |
158 params.fetch_valid_primary_icon ? primary_icon_url_ : GURL(), | |
159 params.fetch_valid_primary_icon ? primary_icon_.get() : nullptr, | |
160 params.fetch_valid_badge_icon ? badge_icon_url_ : GURL(), | |
161 params.fetch_valid_badge_icon ? badge_icon_.get() : nullptr, | |
162 params.check_installable ? is_installable_ : false}); | |
163 } | |
164 | |
165 void SetInstallable(bool is_installable) { is_installable_ = is_installable; } | |
166 | |
167 void SetManifest(const content::Manifest& manifest) { | |
168 manifest_ = manifest; | |
169 | |
170 if (manifest.icons.empty()) { | |
171 code_ = NO_ACCEPTABLE_ICON; | |
172 is_installable_ = false; | |
173 } else { | |
174 primary_icon_url_ = manifest_.icons[0].src; | |
175 primary_icon_.reset( | |
176 new SkBitmap(gfx::test::CreateBitmap(kIconSizePx, kIconSizePx))); | |
177 | |
178 badge_icon_url_ = manifest_.icons[0].src; | |
179 badge_icon_.reset( | |
180 new SkBitmap(gfx::test::CreateBitmap(kIconSizePx, kIconSizePx))); | |
181 code_ = NO_ERROR_DETECTED; | |
182 is_installable_ = true; | |
183 } | |
184 } | |
185 | |
186 void SetShouldManifestTimeOut(bool should_time_out) { | |
187 should_manifest_time_out_ = should_time_out; | |
188 } | |
189 | |
190 void SetShouldInstallableTimeOut(bool should_time_out) { | |
191 should_installable_time_out_ = should_time_out; | |
192 } | |
193 | |
194 private: | |
195 InstallableStatusCode code_; | |
196 content::Manifest manifest_; | |
197 GURL primary_icon_url_; | |
198 GURL badge_icon_url_; | |
199 std::unique_ptr<SkBitmap> primary_icon_; | |
200 std::unique_ptr<SkBitmap> badge_icon_; | |
201 | |
202 bool is_installable_ = false; | |
203 | |
204 bool should_manifest_time_out_ = false; | |
205 bool should_installable_time_out_ = false; | |
206 }; | |
207 | |
202 // Tests AddToHomescreenDataFetcher. These tests should be browser tests but | 208 // Tests AddToHomescreenDataFetcher. These tests should be browser tests but |
203 // Android does not support browser tests yet (crbug.com/611756). | 209 // Android does not support browser tests yet (crbug.com/611756). |
204 class AddToHomescreenDataFetcherTest : public ChromeRenderViewHostTestHarness { | 210 class AddToHomescreenDataFetcherTest : public ChromeRenderViewHostTestHarness { |
205 public: | 211 public: |
206 AddToHomescreenDataFetcherTest() {} | 212 AddToHomescreenDataFetcherTest() {} |
207 ~AddToHomescreenDataFetcherTest() override {} | 213 ~AddToHomescreenDataFetcherTest() override {} |
208 | 214 |
209 void SetUp() override { | 215 void SetUp() override { |
210 ChromeRenderViewHostTestHarness::SetUp(); | 216 ChromeRenderViewHostTestHarness::SetUp(); |
211 | 217 |
212 ASSERT_TRUE(profile()->CreateHistoryService(false, true)); | 218 ASSERT_TRUE(profile()->CreateHistoryService(false, true)); |
213 profile()->CreateFaviconService(); | 219 profile()->CreateFaviconService(); |
214 | 220 |
215 embedded_worker_test_helper_.reset( | 221 // Manually inject the TestInstallableManager as a "InstallableManager" |
216 new content::EmbeddedWorkerTestHelper(base::FilePath())); | 222 // WebContentsUserData. We can't directly call ::CreateForWebContents due to |
217 | 223 // typing issues since TestInstallableManager doesn't directly inherit from |
218 scoped_refptr<content::SiteInstance> site_instance = | 224 // WebContentsUserData. |
219 content::SiteInstance::Create(browser_context()); | 225 web_contents()->SetUserData( |
220 site_instance->GetProcess()->Init(); | 226 TestInstallableManager::UserDataKey(), |
221 MockWebContents* mock_web_contents = new MockWebContents(browser_context()); | 227 base::WrapUnique(new TestInstallableManager(web_contents()))); |
222 mock_web_contents->Init(content::WebContents::CreateParams( | 228 installable_manager_ = static_cast<TestInstallableManager*>( |
223 browser_context(), std::move(site_instance))); | 229 web_contents()->GetUserData(TestInstallableManager::UserDataKey())); |
224 InstallableManager::CreateForWebContents(mock_web_contents); | |
225 SetContents(mock_web_contents); | |
226 NavigateAndCommit(GURL(kDefaultStartUrl)); | |
227 } | |
228 | |
229 void TearDown() override { | |
230 embedded_worker_test_helper_.reset(); | |
231 ChromeRenderViewHostTestHarness::TearDown(); | |
232 } | 230 } |
233 | 231 |
234 scoped_refptr<AddToHomescreenDataFetcher> BuildFetcher( | 232 scoped_refptr<AddToHomescreenDataFetcher> BuildFetcher( |
235 bool check_webapk_compatible, | 233 bool check_webapk_compatible, |
236 AddToHomescreenDataFetcher::Observer* observer) { | 234 AddToHomescreenDataFetcher::Observer* observer) { |
237 return new AddToHomescreenDataFetcher(web_contents(), 1, 1, 1, 1, 1, 500, | 235 return new AddToHomescreenDataFetcher(web_contents(), 1, 1, 1, 1, 1, 500, |
238 check_webapk_compatible, observer); | 236 check_webapk_compatible, observer); |
239 } | 237 } |
240 | 238 |
241 // Set the manifest to be returned as a result of WebContents::GetManifest(). | 239 void RunFetcher(scoped_refptr<AddToHomescreenDataFetcher> fetcher, |
242 void SetManifest(const GURL& manifest_url, | 240 ObserverWaiter& waiter, |
243 const content::Manifest& manifest) { | 241 const char* expected_title, |
244 MockWebContents* mock_web_contents = | 242 blink::WebDisplayMode display_mode, |
245 static_cast<MockWebContents*>(web_contents()); | 243 bool is_webapk_compatible) { |
246 mock_web_contents->SetManifest(manifest_url, manifest); | 244 WebApplicationInfo web_application_info; |
245 web_application_info.title = base::UTF8ToUTF16(kWebApplicationInfoTitle); | |
246 | |
247 fetcher->OnDidGetWebApplicationInfo(web_application_info); | |
248 waiter.WaitForDataAvailable(); | |
249 | |
250 EXPECT_EQ(check_webapk_compatibility(), | |
251 waiter.determined_webapk_compatibility()); | |
252 EXPECT_EQ(is_webapk_compatible, waiter.is_webapk_compatible()); | |
253 EXPECT_TRUE(waiter.title_available()); | |
254 EXPECT_TRUE(base::EqualsASCII(waiter.title(), expected_title)); | |
255 EXPECT_TRUE( | |
256 base::EqualsASCII(fetcher->shortcut_info().user_title, expected_title)); | |
257 EXPECT_EQ(display_mode, fetcher->shortcut_info().display); | |
247 } | 258 } |
248 | 259 |
249 void SetShouldImageTimeOut(bool should_time_out) { | 260 void SetManifest(const content::Manifest& manifest) { |
250 MockWebContents* mock_web_contents = | 261 installable_manager_->SetManifest(manifest); |
251 static_cast<MockWebContents*>(web_contents()); | 262 } |
252 mock_web_contents->SetShouldImageTimeOut(should_time_out); | 263 |
264 void SetInstallable(bool is_installable) { | |
265 installable_manager_->SetInstallable(is_installable); | |
253 } | 266 } |
254 | 267 |
255 void SetShouldManifestTimeOut(bool should_time_out) { | 268 void SetShouldManifestTimeOut(bool should_time_out) { |
256 MockWebContents* mock_web_contents = | 269 installable_manager_->SetShouldManifestTimeOut(should_time_out); |
257 static_cast<MockWebContents*>(web_contents()); | |
258 mock_web_contents->SetShouldManifestTimeOut(should_time_out); | |
259 } | 270 } |
260 | 271 |
261 // Registers service worker at |url|. Blocks till the service worker is | 272 void SetShouldInstallableTimeOut(bool should_time_out) { |
262 // registered. | 273 installable_manager_->SetShouldInstallableTimeOut(should_time_out); |
263 void RegisterServiceWorker(const GURL& url) { | |
264 base::RunLoop run_loop; | |
265 embedded_worker_test_helper_->context()->RegisterServiceWorker( | |
266 url, GURL(url.spec() + "/service_worker.js"), nullptr, | |
267 base::Bind(&AddToHomescreenDataFetcherTest::OnServiceWorkerRegistered, | |
268 base::Unretained(this), run_loop.QuitClosure())); | |
269 } | 274 } |
270 | 275 |
276 virtual bool check_webapk_compatibility() { return true; } | |
277 | |
271 private: | 278 private: |
272 // Callback for RegisterServiceWorker() for when service worker registration | 279 TestInstallableManager* installable_manager_; |
273 // has completed. | |
274 void OnServiceWorkerRegistered(const base::Closure& callback, | |
275 content::ServiceWorkerStatusCode status, | |
276 const std::string& status_message, | |
277 int64_t registration_id) { | |
278 ASSERT_EQ(content::SERVICE_WORKER_OK, status) | |
279 << content::ServiceWorkerStatusToString(status); | |
280 callback.Run(); | |
281 } | |
282 | |
283 std::unique_ptr<content::EmbeddedWorkerTestHelper> | |
284 embedded_worker_test_helper_; | |
285 | 280 |
286 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcherTest); | 281 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcherTest); |
287 }; | 282 }; |
288 | 283 |
289 // Class for tests which should be run with AddToHomescreenDataFetcher built | 284 // Class for tests which should be run with AddToHomescreenDataFetcher built |
290 // with both true and false values of |check_webapk_compatible|. | 285 // with both true and false values of |check_webapk_compatible|. |
291 class AddToHomescreenDataFetcherTestCommon | 286 class AddToHomescreenDataFetcherTestCommon |
292 : public AddToHomescreenDataFetcherTest, | 287 : public AddToHomescreenDataFetcherTest, |
293 public testing::WithParamInterface<bool> { | 288 public testing::WithParamInterface<bool> { |
294 public: | 289 public: |
295 AddToHomescreenDataFetcherTestCommon() {} | 290 AddToHomescreenDataFetcherTestCommon() {} |
296 ~AddToHomescreenDataFetcherTestCommon() override {} | 291 ~AddToHomescreenDataFetcherTestCommon() override {} |
297 | 292 |
298 scoped_refptr<AddToHomescreenDataFetcher> BuildFetcher( | 293 scoped_refptr<AddToHomescreenDataFetcher> BuildFetcher( |
299 AddToHomescreenDataFetcher::Observer* observer) { | 294 AddToHomescreenDataFetcher::Observer* observer) { |
300 return AddToHomescreenDataFetcherTest::BuildFetcher( | 295 return AddToHomescreenDataFetcherTest::BuildFetcher( |
301 check_webapk_compatibility(), observer); | 296 check_webapk_compatibility(), observer); |
302 } | 297 } |
303 | 298 |
304 // The value of |check_webapk_compatible| used when building the | 299 // The value of |check_webapk_compatible| used when building the |
305 // AddToHomescreenDataFetcher. | 300 // AddToHomescreenDataFetcher. |
306 bool check_webapk_compatibility() { return GetParam(); } | 301 bool check_webapk_compatibility() override { return GetParam(); } |
307 | 302 |
308 private: | 303 private: |
309 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcherTestCommon); | 304 DISALLOW_COPY_AND_ASSIGN(AddToHomescreenDataFetcherTestCommon); |
310 }; | 305 }; |
311 | 306 |
312 // Checks that AddToHomescreenDataFetcher::Observer::OnUserTitleAvailable() is | |
313 // called when the web manifest returned is empty. The add-to-homescreen dialog | |
314 // makes the dialog's text field editable once OnUserTitleAvailable() is called. | |
315 TEST_P(AddToHomescreenDataFetcherTestCommon, EmptyManifest) { | 307 TEST_P(AddToHomescreenDataFetcherTestCommon, EmptyManifest) { |
316 WebApplicationInfo web_application_info; | 308 // Check that an empty manifest has the appropriate methods run. |
317 web_application_info.title = base::UTF8ToUTF16(kWebApplicationInfoTitle); | 309 ObserverWaiter waiter; |
318 | 310 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); |
319 SetManifest(GURL(kDefaultManifestUrl), BuildEmptyManifest()); | 311 RunFetcher(fetcher, waiter, kWebApplicationInfoTitle, |
320 | 312 blink::kWebDisplayModeBrowser, false); |
321 ObserverWaiter waiter; | 313 fetcher->set_weak_observer(nullptr); |
322 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); | 314 } |
323 fetcher->OnDidGetWebApplicationInfo(web_application_info); | 315 |
324 waiter.WaitForDataAvailable(); | 316 TEST_P(AddToHomescreenDataFetcherTestCommon, NoIconManifest) { |
325 | 317 // Test a manifest with no icons. This should use the metadata title and have |
pkotwicz
2017/07/05 21:37:43
The AddToHomescreenDataFetcher uses kDefaultManife
dominickn
2017/07/06 01:44:01
Done.
| |
326 EXPECT_EQ(check_webapk_compatibility(), | 318 // an empty icon in this test runner (in production the empty icon would be |
327 waiter.determined_webapk_compatibility()); | 319 // replaced by a favicon or a generated icon). |
328 EXPECT_FALSE(waiter.is_webapk_compatible()); | 320 content::Manifest manifest = BuildDefaultManifest(); |
329 EXPECT_TRUE(waiter.title_available()); | 321 manifest.icons.clear(); |
330 EXPECT_TRUE(base::EqualsASCII(waiter.title(), kWebApplicationInfoTitle)); | 322 SetManifest(manifest); |
331 | 323 |
332 fetcher->set_weak_observer(nullptr); | 324 ObserverWaiter waiter; |
333 } | 325 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); |
334 | 326 RunFetcher(fetcher, waiter, kDefaultManifestShortName, |
335 // Test that when the manifest provides Manifest::short_name but not | 327 blink::kWebDisplayModeStandalone, false); |
336 // Manifest::name that Manifest::short_name is used as the name instead of | 328 |
337 // WebApplicationInfo::title. | 329 EXPECT_TRUE(fetcher->primary_icon().drawsNothing()); |
330 EXPECT_TRUE(fetcher->shortcut_info().best_primary_icon_url.is_empty()); | |
331 EXPECT_TRUE(fetcher->badge_icon().drawsNothing()); | |
332 EXPECT_TRUE(fetcher->shortcut_info().best_badge_icon_url.is_empty()); | |
333 | |
334 fetcher->set_weak_observer(nullptr); | |
335 } | |
336 | |
337 TEST_P(AddToHomescreenDataFetcherTestCommon, ManifestFetchTimesOut) { | |
338 // Check that the AddToHomescreenDataFetcher::Observer methods are called | |
339 // if the first call to InstallableManager::GetData() times out. This should | |
340 // fall back to the metadata title and have an empty icon. | |
341 SetShouldManifestTimeOut(true); | |
342 SetManifest(BuildDefaultManifest()); | |
343 | |
344 { | |
345 // Check a site with no service worker. | |
346 ObserverWaiter waiter; | |
347 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); | |
348 RunFetcher(fetcher, waiter, kWebApplicationInfoTitle, | |
349 blink::kWebDisplayModeBrowser, false); | |
350 | |
351 EXPECT_TRUE(fetcher->primary_icon().drawsNothing()); | |
352 EXPECT_TRUE(fetcher->shortcut_info().best_primary_icon_url.is_empty()); | |
353 | |
354 fetcher->set_weak_observer(nullptr); | |
355 } | |
356 | |
357 { | |
358 // Check with a service worker present. | |
pkotwicz
2017/07/05 21:37:43
Lines 346-354 are identical to lines 359-367
dominickn
2017/07/06 01:44:01
Done.
| |
359 ObserverWaiter waiter; | |
360 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); | |
361 RunFetcher(fetcher, waiter, kWebApplicationInfoTitle, | |
362 blink::kWebDisplayModeBrowser, false); | |
363 | |
364 EXPECT_TRUE(fetcher->primary_icon().drawsNothing()); | |
365 EXPECT_TRUE(fetcher->shortcut_info().best_primary_icon_url.is_empty()); | |
366 | |
367 fetcher->set_weak_observer(nullptr); | |
368 } | |
369 } | |
370 | |
371 TEST_F(AddToHomescreenDataFetcherTest, ServiceWorkerCheckTimesOut) { | |
372 { | |
373 // Check that the AddToHomescreenDataFetcher::Observer methods are called | |
374 // if the service worker check times out on a page that is installable (i.e. | |
375 // it's taken too long). This should use the short_name and icon from the | |
376 // manifest, but not be WebAPK-compatible. Only relevant when checking | |
377 // WebAPK compatibility. | |
378 SetManifest(BuildDefaultManifest()); | |
379 SetShouldInstallableTimeOut(true); | |
380 | |
381 ObserverWaiter waiter; | |
382 scoped_refptr<AddToHomescreenDataFetcher> fetcher( | |
383 BuildFetcher(true, &waiter)); | |
384 RunFetcher(fetcher, waiter, kDefaultManifestShortName, | |
385 blink::kWebDisplayModeStandalone, false); | |
386 | |
387 EXPECT_FALSE(fetcher->primary_icon().drawsNothing()); | |
388 EXPECT_EQ(fetcher->shortcut_info().best_primary_icon_url, | |
389 GURL(kDefaultIconUrl)); | |
390 | |
391 fetcher->set_weak_observer(nullptr); | |
392 } | |
393 | |
394 { | |
395 // Check the case where the service worker check times out because the | |
396 // service worker doesn't exist. | |
397 SetInstallable(false); | |
398 SetShouldInstallableTimeOut(true); | |
pkotwicz
2017/07/05 21:37:43
Remove call to SetInstallable(false) because
SetSh
dominickn
2017/07/06 01:44:01
Done.
| |
399 | |
400 ObserverWaiter waiter; | |
401 scoped_refptr<AddToHomescreenDataFetcher> fetcher( | |
402 BuildFetcher(true, &waiter)); | |
403 RunFetcher(fetcher, waiter, kDefaultManifestShortName, | |
404 blink::kWebDisplayModeStandalone, false); | |
405 | |
406 EXPECT_FALSE(fetcher->primary_icon().drawsNothing()); | |
407 EXPECT_EQ(fetcher->shortcut_info().best_primary_icon_url, | |
408 GURL(kDefaultIconUrl)); | |
409 | |
410 fetcher->set_weak_observer(nullptr); | |
411 } | |
412 } | |
413 | |
414 TEST_P(AddToHomescreenDataFetcherTestCommon, InstallableManifest) { | |
415 // Test an installable manifest for a site that has a service worker. | |
416 content::Manifest manifest(BuildDefaultManifest()); | |
417 SetManifest(manifest); | |
418 | |
419 ObserverWaiter waiter; | |
420 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); | |
421 RunFetcher(fetcher, waiter, kDefaultManifestShortName, | |
422 blink::kWebDisplayModeStandalone, check_webapk_compatibility()); | |
423 | |
424 // There should always be a primary icon. The badge icon should only be | |
425 // present if we checked for WebAPK compatibility. | |
426 EXPECT_FALSE(fetcher->primary_icon().drawsNothing()); | |
427 EXPECT_EQ(fetcher->shortcut_info().best_primary_icon_url, | |
428 GURL(kDefaultIconUrl)); | |
429 | |
430 // Check that the badge icon is requested only when AddToHomescreenDataFetcher | |
431 // checks for WebAPK compatibility. | |
432 if (check_webapk_compatibility()) { | |
433 EXPECT_FALSE(fetcher->badge_icon().drawsNothing()); | |
434 EXPECT_EQ(fetcher->shortcut_info().best_badge_icon_url, | |
435 GURL(kDefaultIconUrl)); | |
436 } else { | |
437 EXPECT_TRUE(fetcher->badge_icon().drawsNothing()); | |
438 EXPECT_TRUE(fetcher->shortcut_info().best_badge_icon_url.is_empty()); | |
439 } | |
440 | |
441 fetcher->set_weak_observer(nullptr); | |
442 } | |
443 | |
338 TEST_P(AddToHomescreenDataFetcherTestCommon, | 444 TEST_P(AddToHomescreenDataFetcherTestCommon, |
339 ManifestShortNameClobbersWebApplicationName) { | 445 ManifestNameClobbersWebApplicationName) { |
340 WebApplicationInfo web_application_info; | 446 // Test that when the manifest provides Manifest::name but not |
341 web_application_info.title = base::UTF8ToUTF16(kWebApplicationInfoTitle); | 447 // Manifest::short_name that Manifest::name is used as the title. |
342 | 448 { |
343 content::Manifest manifest(BuildDefaultManifest()); | 449 // Check the case where we have no icons. |
344 manifest.name = base::NullableString16(); | 450 content::Manifest manifest = BuildDefaultManifest(); |
345 | 451 manifest.icons.clear(); |
346 RegisterServiceWorker(GURL(kDefaultStartUrl)); | 452 manifest.short_name = base::NullableString16(); |
347 SetManifest(GURL(kDefaultManifestUrl), manifest); | 453 SetManifest(manifest); |
348 | 454 |
349 ObserverWaiter waiter; | 455 ObserverWaiter waiter; |
350 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); | 456 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); |
351 fetcher->OnDidGetWebApplicationInfo(web_application_info); | 457 RunFetcher(fetcher, waiter, kDefaultManifestName, |
352 waiter.WaitForDataAvailable(); | 458 blink::kWebDisplayModeStandalone, false); |
353 | 459 |
354 EXPECT_TRUE(base::EqualsASCII(waiter.title(), kDefaultManifestShortName)); | 460 EXPECT_TRUE(fetcher->primary_icon().drawsNothing()); |
355 EXPECT_TRUE(base::EqualsASCII(fetcher->shortcut_info().name, | 461 EXPECT_TRUE(fetcher->shortcut_info().best_primary_icon_url.is_empty()); |
356 kDefaultManifestShortName)); | 462 EXPECT_TRUE(base::EqualsASCII(fetcher->shortcut_info().short_name, |
357 | 463 kDefaultManifestName)); |
358 fetcher->set_weak_observer(nullptr); | 464 |
359 } | 465 fetcher->set_weak_observer(nullptr); |
360 | 466 } |
361 // Test that when the manifest does not provide either Manifest::short_name nor | 467 |
362 // Manifest::name that: | 468 { |
363 // - The page is not WebAPK compatible. | 469 // Check a site with no service worker. |
364 // - WebApplicationInfo::title is used as the "name". | 470 content::Manifest manifest(BuildDefaultManifest()); |
471 manifest.short_name = base::NullableString16(); | |
472 SetManifest(manifest); | |
pkotwicz
2017/07/05 21:37:43
Nit: Can you move the manifest construction out of
dominickn
2017/07/06 01:44:01
Done.
| |
473 SetShouldInstallableTimeOut(true); | |
474 SetInstallable(false); | |
pkotwicz
2017/07/05 21:37:43
Nit: Remove call to SetInstallable(false) because
dominickn
2017/07/06 01:44:01
Done.
dominickn
2017/07/06 01:44:01
Done.
| |
475 | |
476 ObserverWaiter waiter; | |
477 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); | |
478 RunFetcher(fetcher, waiter, kDefaultManifestName, | |
479 blink::kWebDisplayModeStandalone, false); | |
480 | |
481 EXPECT_FALSE(fetcher->primary_icon().drawsNothing()); | |
482 EXPECT_EQ(fetcher->shortcut_info().best_primary_icon_url, | |
483 GURL(kDefaultIconUrl)); | |
484 EXPECT_TRUE(base::EqualsASCII(fetcher->shortcut_info().short_name, | |
485 kDefaultManifestName)); | |
486 | |
487 fetcher->set_weak_observer(nullptr); | |
488 } | |
489 | |
490 { | |
491 // Check a site with a service worker, but the service worker check times | |
492 // out because its too slow. | |
493 SetShouldInstallableTimeOut(true); | |
494 SetInstallable(true); | |
495 | |
496 ObserverWaiter waiter; | |
497 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); | |
498 RunFetcher(fetcher, waiter, kDefaultManifestName, | |
499 blink::kWebDisplayModeStandalone, false); | |
500 | |
501 EXPECT_FALSE(fetcher->primary_icon().drawsNothing()); | |
502 EXPECT_EQ(fetcher->shortcut_info().best_primary_icon_url, | |
503 GURL(kDefaultIconUrl)); | |
504 EXPECT_TRUE(base::EqualsASCII(fetcher->shortcut_info().short_name, | |
505 kDefaultManifestName)); | |
506 | |
507 fetcher->set_weak_observer(nullptr); | |
508 } | |
509 | |
510 { | |
511 // Check a site with a service worker. | |
512 SetShouldInstallableTimeOut(false); | |
513 SetInstallable(true); | |
514 ObserverWaiter waiter; | |
515 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); | |
516 RunFetcher(fetcher, waiter, kDefaultManifestName, | |
517 blink::kWebDisplayModeStandalone, check_webapk_compatibility()); | |
518 | |
519 EXPECT_FALSE(fetcher->primary_icon().drawsNothing()); | |
520 EXPECT_EQ(fetcher->shortcut_info().best_primary_icon_url, | |
521 GURL(kDefaultIconUrl)); | |
522 EXPECT_TRUE(base::EqualsASCII(fetcher->shortcut_info().short_name, | |
523 kDefaultManifestName)); | |
524 | |
525 fetcher->set_weak_observer(nullptr); | |
526 } | |
527 } | |
528 | |
365 TEST_P(AddToHomescreenDataFetcherTestCommon, ManifestNoNameNoShortName) { | 529 TEST_P(AddToHomescreenDataFetcherTestCommon, ManifestNoNameNoShortName) { |
366 WebApplicationInfo web_application_info; | 530 // Test that when the manifest does not provide either Manifest::short_name |
367 web_application_info.title = base::UTF8ToUTF16(kWebApplicationInfoTitle); | 531 // nor Manifest::name that: |
368 | 532 // - The page is not WebAPK compatible. |
533 // - WebApplicationInfo::title is used as the "name". | |
534 // - We still use the icons from the manifest. | |
369 content::Manifest manifest(BuildDefaultManifest()); | 535 content::Manifest manifest(BuildDefaultManifest()); |
370 manifest.name = base::NullableString16(); | 536 manifest.name = base::NullableString16(); |
371 manifest.short_name = base::NullableString16(); | 537 manifest.short_name = base::NullableString16(); |
372 | 538 |
373 RegisterServiceWorker(GURL(kDefaultStartUrl)); | 539 // Check the case where we don't time out waiting for the service worker. |
374 SetManifest(GURL(kDefaultManifestUrl), manifest); | 540 SetManifest(manifest); |
375 | 541 SetShouldInstallableTimeOut(false); |
376 ObserverWaiter waiter; | 542 ObserverWaiter waiter; |
377 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); | 543 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); |
378 fetcher->OnDidGetWebApplicationInfo(web_application_info); | 544 RunFetcher(fetcher, waiter, kWebApplicationInfoTitle, |
379 waiter.WaitForDataAvailable(); | 545 blink::kWebDisplayModeStandalone, false); |
380 | 546 |
381 EXPECT_EQ(check_webapk_compatibility(), | |
382 waiter.determined_webapk_compatibility()); | |
383 EXPECT_FALSE(waiter.is_webapk_compatible()); | |
384 EXPECT_TRUE(base::EqualsASCII(waiter.title(), kWebApplicationInfoTitle)); | |
385 EXPECT_TRUE(base::EqualsASCII(fetcher->shortcut_info().name, | 547 EXPECT_TRUE(base::EqualsASCII(fetcher->shortcut_info().name, |
386 kWebApplicationInfoTitle)); | 548 kWebApplicationInfoTitle)); |
387 | 549 EXPECT_TRUE(base::EqualsASCII(fetcher->shortcut_info().short_name, |
388 fetcher->set_weak_observer(nullptr); | 550 kWebApplicationInfoTitle)); |
389 } | 551 EXPECT_FALSE(fetcher->primary_icon().drawsNothing()); |
390 | 552 EXPECT_EQ(fetcher->shortcut_info().best_primary_icon_url, |
391 // Checks that the AddToHomescreenDataFetcher::Observer callbacks are called | 553 GURL(kDefaultIconUrl)); |
392 // when the manifest fetch times out. | 554 |
393 TEST_P(AddToHomescreenDataFetcherTestCommon, ManifestFetchTimesOut) { | 555 fetcher->set_weak_observer(nullptr); |
394 WebApplicationInfo web_application_info; | 556 } |
395 web_application_info.title = base::UTF8ToUTF16(kWebApplicationInfoTitle); | |
396 | |
397 RegisterServiceWorker(GURL(kDefaultStartUrl)); | |
398 SetManifest(GURL(kDefaultManifestUrl), BuildDefaultManifest()); | |
399 SetShouldManifestTimeOut(true); | |
400 SetShouldImageTimeOut(false); | |
401 | |
402 ObserverWaiter waiter; | |
403 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); | |
404 fetcher->OnDidGetWebApplicationInfo(web_application_info); | |
405 waiter.WaitForDataAvailable(); | |
406 | |
407 EXPECT_EQ(check_webapk_compatibility(), | |
408 waiter.determined_webapk_compatibility()); | |
409 EXPECT_FALSE(waiter.is_webapk_compatible()); | |
410 EXPECT_TRUE(base::EqualsASCII(waiter.title(), kWebApplicationInfoTitle)); | |
411 EXPECT_TRUE(waiter.title_available()); | |
412 | |
413 fetcher->set_weak_observer(nullptr); | |
414 } | |
415 | |
416 // Checks that the AddToHomescreenDataFetcher::Observer callbacks are called | |
417 // when the image fetch times out. | |
418 TEST_P(AddToHomescreenDataFetcherTestCommon, ImageFetchTimesOut) { | |
419 WebApplicationInfo web_application_info; | |
420 web_application_info.title = base::UTF8ToUTF16(kWebApplicationInfoTitle); | |
421 | |
422 RegisterServiceWorker(GURL(kDefaultStartUrl)); | |
423 SetManifest(GURL(kDefaultManifestUrl), BuildDefaultManifest()); | |
424 SetShouldManifestTimeOut(false); | |
425 SetShouldImageTimeOut(true); | |
426 | |
427 ObserverWaiter waiter; | |
428 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); | |
429 fetcher->OnDidGetWebApplicationInfo(web_application_info); | |
430 waiter.WaitForDataAvailable(); | |
431 | |
432 EXPECT_EQ(check_webapk_compatibility(), | |
433 waiter.determined_webapk_compatibility()); | |
434 EXPECT_FALSE(waiter.is_webapk_compatible()); | |
435 EXPECT_TRUE(waiter.title_available()); | |
436 EXPECT_TRUE(base::EqualsASCII(waiter.title(), kWebApplicationInfoTitle)); | |
437 | |
438 fetcher->set_weak_observer(nullptr); | |
439 } | |
440 | |
441 // Checks that the AddToHomescreenDataFetcher::Observer callbacks are called | |
442 // when the service worker check times out. | |
443 TEST_P(AddToHomescreenDataFetcherTestCommon, ServiceWorkerCheckTimesOut) { | |
444 WebApplicationInfo web_application_info; | |
445 web_application_info.title = base::UTF8ToUTF16(kWebApplicationInfoTitle); | |
446 | |
447 // Not registering a service worker means we'll wait and time out for the | |
448 // worker. | |
449 SetManifest(GURL(kDefaultManifestUrl), BuildDefaultManifest()); | |
450 SetShouldManifestTimeOut(false); | |
451 SetShouldImageTimeOut(false); | |
452 | |
453 ObserverWaiter waiter; | |
454 scoped_refptr<AddToHomescreenDataFetcher> fetcher(BuildFetcher(&waiter)); | |
455 fetcher->OnDidGetWebApplicationInfo(web_application_info); | |
456 waiter.WaitForDataAvailable(); | |
457 | |
458 EXPECT_EQ(check_webapk_compatibility(), | |
459 waiter.determined_webapk_compatibility()); | |
460 EXPECT_FALSE(waiter.is_webapk_compatible()); | |
461 EXPECT_TRUE(waiter.title_available()); | |
462 EXPECT_TRUE(base::EqualsASCII(waiter.title(), kDefaultManifestShortName)); | |
463 EXPECT_TRUE(base::EqualsASCII(fetcher->shortcut_info().user_title, | |
464 kDefaultManifestShortName)); | |
465 | |
466 fetcher->set_weak_observer(nullptr); | |
467 } | |
468 | 557 |
469 INSTANTIATE_TEST_CASE_P(CheckWebApkCompatibility, | 558 INSTANTIATE_TEST_CASE_P(CheckWebApkCompatibility, |
470 AddToHomescreenDataFetcherTestCommon, | 559 AddToHomescreenDataFetcherTestCommon, |
471 ::testing::Values(false, true)); | 560 ::testing::Values(false, true)); |
OLD | NEW |