OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/strings/stringprintf.h" | |
6 #include "base/strings/utf_string_conversions.h" | |
7 #include "chrome/browser/automation/automation_util.h" | |
8 #include "chrome/browser/extensions/extension_test_message_listener.h" | |
9 #include "chrome/browser/extensions/platform_app_browsertest_util.h" | |
10 #include "chrome/browser/prerender/prerender_link_manager.h" | |
11 #include "chrome/browser/prerender/prerender_link_manager_factory.h" | |
12 #include "chrome/browser/profiles/profile.h" | |
13 #include "chrome/browser/ui/browser.h" | |
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | |
15 #include "chrome/common/extensions/extension.h" | |
16 #include "chrome/test/base/ui_test_utils.h" | |
17 #include "content/public/browser/notification_service.h" | |
18 #include "content/public/browser/render_process_host.h" | |
19 #include "content/public/browser/web_contents_delegate.h" | |
20 #include "content/public/test/browser_test_utils.h" | |
21 #include "content/public/test/fake_speech_recognition_manager.h" | |
22 #include "net/test/embedded_test_server/embedded_test_server.h" | |
23 #include "net/test/embedded_test_server/http_request.h" | |
24 #include "net/test/embedded_test_server/http_response.h" | |
25 #include "ui/gl/gl_switches.h" | |
26 | |
27 // For fine-grained suppression on flaky tests. | |
28 #if defined(OS_WIN) | |
29 #include "base/win/windows_version.h" | |
30 #endif | |
31 | |
32 using prerender::PrerenderLinkManager; | |
33 using prerender::PrerenderLinkManagerFactory; | |
34 | |
35 namespace { | |
36 const char kEmptyResponsePath[] = "/close-socket"; | |
37 const char kRedirectResponsePath[] = "/server-redirect"; | |
38 const char kRedirectResponseFullPath[] = | |
39 "/extensions/platform_apps/web_view/shim/guest_redirect.html"; | |
40 | |
41 class EmptyHttpResponse : public net::test_server::HttpResponse { | |
42 public: | |
43 virtual std::string ToResponseString() const OVERRIDE { | |
44 return std::string(); | |
45 } | |
46 }; | |
47 } // namespace | |
48 | |
49 // This class intercepts media access request from the embedder. The request | |
50 // should be triggered only if the embedder API (from tests) allows the request | |
51 // in Javascript. | |
52 // We do not issue the actual media request; the fact that the request reached | |
53 // embedder's WebContents is good enough for our tests. This is also to make | |
54 // the test run successfully on trybots. | |
55 class MockWebContentsDelegate : public content::WebContentsDelegate { | |
56 public: | |
57 MockWebContentsDelegate() : requested_(false) {} | |
58 virtual ~MockWebContentsDelegate() {} | |
59 | |
60 virtual void RequestMediaAccessPermission( | |
61 content::WebContents* web_contents, | |
62 const content::MediaStreamRequest& request, | |
63 const content::MediaResponseCallback& callback) OVERRIDE { | |
64 requested_ = true; | |
65 if (message_loop_runner_.get()) | |
66 message_loop_runner_->Quit(); | |
67 } | |
68 | |
69 void WaitForSetMediaPermission() { | |
70 if (requested_) | |
71 return; | |
72 message_loop_runner_ = new content::MessageLoopRunner; | |
73 message_loop_runner_->Run(); | |
74 } | |
75 | |
76 private: | |
77 bool requested_; | |
78 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | |
79 | |
80 DISALLOW_COPY_AND_ASSIGN(MockWebContentsDelegate); | |
81 }; | |
82 | |
83 // This class intercepts download request from the guest. | |
84 class MockDownloadWebContentsDelegate : public content::WebContentsDelegate { | |
85 public: | |
86 explicit MockDownloadWebContentsDelegate( | |
87 content::WebContentsDelegate* orig_delegate) | |
88 : orig_delegate_(orig_delegate), | |
89 waiting_for_decision_(false), | |
90 expect_allow_(false), | |
91 decision_made_(false), | |
92 last_download_allowed_(false) {} | |
93 virtual ~MockDownloadWebContentsDelegate() {} | |
94 | |
95 virtual void CanDownload( | |
96 content::RenderViewHost* render_view_host, | |
97 int request_id, | |
98 const std::string& request_method, | |
99 const base::Callback<void(bool)>& callback) OVERRIDE { | |
100 orig_delegate_->CanDownload( | |
101 render_view_host, request_id, request_method, | |
102 base::Bind(&MockDownloadWebContentsDelegate::DownloadDecided, | |
103 base::Unretained(this))); | |
104 } | |
105 | |
106 void WaitForCanDownload(bool expect_allow) { | |
107 EXPECT_FALSE(waiting_for_decision_); | |
108 waiting_for_decision_ = true; | |
109 | |
110 if (decision_made_) { | |
111 EXPECT_EQ(expect_allow, last_download_allowed_); | |
112 return; | |
113 } | |
114 | |
115 expect_allow_ = expect_allow; | |
116 message_loop_runner_ = new content::MessageLoopRunner; | |
117 message_loop_runner_->Run(); | |
118 } | |
119 | |
120 void DownloadDecided(bool allow) { | |
121 EXPECT_FALSE(decision_made_); | |
122 decision_made_ = true; | |
123 | |
124 if (waiting_for_decision_) { | |
125 EXPECT_EQ(expect_allow_, allow); | |
126 if (message_loop_runner_.get()) | |
127 message_loop_runner_->Quit(); | |
128 return; | |
129 } | |
130 last_download_allowed_ = allow; | |
131 } | |
132 | |
133 void Reset() { | |
134 waiting_for_decision_ = false; | |
135 decision_made_ = false; | |
136 } | |
137 | |
138 private: | |
139 content::WebContentsDelegate* orig_delegate_; | |
140 bool waiting_for_decision_; | |
141 bool expect_allow_; | |
142 bool decision_made_; | |
143 bool last_download_allowed_; | |
144 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | |
145 | |
146 DISALLOW_COPY_AND_ASSIGN(MockDownloadWebContentsDelegate); | |
147 }; | |
148 | |
149 class WebViewTest : public extensions::PlatformAppBrowserTest { | |
150 protected: | |
151 virtual void SetUp() OVERRIDE { | |
152 const testing::TestInfo* const test_info = | |
153 testing::UnitTest::GetInstance()->current_test_info(); | |
154 | |
155 // SpeechRecognition test specific SetUp. | |
156 if (!strcmp(test_info->name(), "SpeechRecognition")) { | |
157 fake_speech_recognition_manager_.reset( | |
158 new content::FakeSpeechRecognitionManager()); | |
159 fake_speech_recognition_manager_->set_should_send_fake_response(true); | |
160 // Inject the fake manager factory so that the test result is returned to | |
161 // the web page. | |
162 content::SpeechRecognitionManager::SetManagerForTests( | |
163 fake_speech_recognition_manager_.get()); | |
164 } | |
165 | |
166 extensions::PlatformAppBrowserTest::SetUp(); | |
167 } | |
168 | |
169 virtual void TearDown() OVERRIDE { | |
170 // SpeechRecognition test specific TearDown. | |
171 const testing::TestInfo* const test_info = | |
172 testing::UnitTest::GetInstance()->current_test_info(); | |
173 if (!strcmp(test_info->name(), "SpeechRecognition")) | |
174 content::SpeechRecognitionManager::SetManagerForTests(NULL); | |
175 | |
176 extensions::PlatformAppBrowserTest::TearDown(); | |
177 } | |
178 | |
179 virtual void SetUpOnMainThread() OVERRIDE { | |
180 const testing::TestInfo* const test_info = | |
181 testing::UnitTest::GetInstance()->current_test_info(); | |
182 // Mock out geolocation for geolocation specific tests. | |
183 if (!strncmp(test_info->name(), "GeolocationAPI", | |
184 strlen("GeolocationAPI"))) { | |
185 ui_test_utils::OverrideGeolocation(10, 20); | |
186 } | |
187 } | |
188 | |
189 // This method is responsible for initializing a packaged app, which contains | |
190 // multiple webview tags. The tags have different partition identifiers and | |
191 // their WebContent objects are returned as output. The method also verifies | |
192 // the expected process allocation and storage partition assignment. | |
193 // The |navigate_to_url| parameter is used to navigate the main browser | |
194 // window. | |
195 // | |
196 // TODO(ajwong): This function is getting to be too large. Either refactor it | |
197 // so the test can specify a configuration of WebView tags that we will | |
198 // dynamically inject JS to generate, or move this test wholesale into | |
199 // something that RunPlatformAppTest() can execute purely in Javascript. This | |
200 // won't let us do a white-box examination of the StoragePartition equivalence | |
201 // directly, but we will be able to view the black box effects which is good | |
202 // enough. http://crbug.com/160361 | |
203 void NavigateAndOpenAppForIsolation( | |
204 GURL navigate_to_url, | |
205 content::WebContents** default_tag_contents1, | |
206 content::WebContents** default_tag_contents2, | |
207 content::WebContents** named_partition_contents1, | |
208 content::WebContents** named_partition_contents2, | |
209 content::WebContents** persistent_partition_contents1, | |
210 content::WebContents** persistent_partition_contents2, | |
211 content::WebContents** persistent_partition_contents3) { | |
212 GURL::Replacements replace_host; | |
213 std::string host_str("localhost"); // Must stay in scope with replace_host. | |
214 replace_host.SetHostStr(host_str); | |
215 | |
216 navigate_to_url = navigate_to_url.ReplaceComponents(replace_host); | |
217 | |
218 GURL tag_url1 = embedded_test_server()->GetURL( | |
219 "/extensions/platform_apps/web_view/isolation/cookie.html"); | |
220 tag_url1 = tag_url1.ReplaceComponents(replace_host); | |
221 GURL tag_url2 = embedded_test_server()->GetURL( | |
222 "/extensions/platform_apps/web_view/isolation/cookie2.html"); | |
223 tag_url2 = tag_url2.ReplaceComponents(replace_host); | |
224 GURL tag_url3 = embedded_test_server()->GetURL( | |
225 "/extensions/platform_apps/web_view/isolation/storage1.html"); | |
226 tag_url3 = tag_url3.ReplaceComponents(replace_host); | |
227 GURL tag_url4 = embedded_test_server()->GetURL( | |
228 "/extensions/platform_apps/web_view/isolation/storage2.html"); | |
229 tag_url4 = tag_url4.ReplaceComponents(replace_host); | |
230 GURL tag_url5 = embedded_test_server()->GetURL( | |
231 "/extensions/platform_apps/web_view/isolation/storage1.html#p1"); | |
232 tag_url5 = tag_url5.ReplaceComponents(replace_host); | |
233 GURL tag_url6 = embedded_test_server()->GetURL( | |
234 "/extensions/platform_apps/web_view/isolation/storage1.html#p2"); | |
235 tag_url6 = tag_url6.ReplaceComponents(replace_host); | |
236 GURL tag_url7 = embedded_test_server()->GetURL( | |
237 "/extensions/platform_apps/web_view/isolation/storage1.html#p3"); | |
238 tag_url7 = tag_url7.ReplaceComponents(replace_host); | |
239 | |
240 ui_test_utils::NavigateToURLWithDisposition( | |
241 browser(), navigate_to_url, CURRENT_TAB, | |
242 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | |
243 | |
244 ui_test_utils::UrlLoadObserver observer1( | |
245 tag_url1, content::NotificationService::AllSources()); | |
246 ui_test_utils::UrlLoadObserver observer2( | |
247 tag_url2, content::NotificationService::AllSources()); | |
248 ui_test_utils::UrlLoadObserver observer3( | |
249 tag_url3, content::NotificationService::AllSources()); | |
250 ui_test_utils::UrlLoadObserver observer4( | |
251 tag_url4, content::NotificationService::AllSources()); | |
252 ui_test_utils::UrlLoadObserver observer5( | |
253 tag_url5, content::NotificationService::AllSources()); | |
254 ui_test_utils::UrlLoadObserver observer6( | |
255 tag_url6, content::NotificationService::AllSources()); | |
256 ui_test_utils::UrlLoadObserver observer7( | |
257 tag_url7, content::NotificationService::AllSources()); | |
258 LoadAndLaunchPlatformApp("web_view/isolation"); | |
259 observer1.Wait(); | |
260 observer2.Wait(); | |
261 observer3.Wait(); | |
262 observer4.Wait(); | |
263 observer5.Wait(); | |
264 observer6.Wait(); | |
265 observer7.Wait(); | |
266 | |
267 content::Source<content::NavigationController> source1 = observer1.source(); | |
268 EXPECT_TRUE(source1->GetWebContents()->GetRenderProcessHost()->IsGuest()); | |
269 content::Source<content::NavigationController> source2 = observer2.source(); | |
270 EXPECT_TRUE(source2->GetWebContents()->GetRenderProcessHost()->IsGuest()); | |
271 content::Source<content::NavigationController> source3 = observer3.source(); | |
272 EXPECT_TRUE(source3->GetWebContents()->GetRenderProcessHost()->IsGuest()); | |
273 content::Source<content::NavigationController> source4 = observer4.source(); | |
274 EXPECT_TRUE(source4->GetWebContents()->GetRenderProcessHost()->IsGuest()); | |
275 content::Source<content::NavigationController> source5 = observer5.source(); | |
276 EXPECT_TRUE(source5->GetWebContents()->GetRenderProcessHost()->IsGuest()); | |
277 content::Source<content::NavigationController> source6 = observer6.source(); | |
278 EXPECT_TRUE(source6->GetWebContents()->GetRenderProcessHost()->IsGuest()); | |
279 content::Source<content::NavigationController> source7 = observer7.source(); | |
280 EXPECT_TRUE(source7->GetWebContents()->GetRenderProcessHost()->IsGuest()); | |
281 | |
282 // Check that the first two tags use the same process and it is different | |
283 // than the process used by the other two. | |
284 EXPECT_EQ(source1->GetWebContents()->GetRenderProcessHost()->GetID(), | |
285 source2->GetWebContents()->GetRenderProcessHost()->GetID()); | |
286 EXPECT_EQ(source3->GetWebContents()->GetRenderProcessHost()->GetID(), | |
287 source4->GetWebContents()->GetRenderProcessHost()->GetID()); | |
288 EXPECT_NE(source1->GetWebContents()->GetRenderProcessHost()->GetID(), | |
289 source3->GetWebContents()->GetRenderProcessHost()->GetID()); | |
290 | |
291 // The two sets of tags should also be isolated from the main browser. | |
292 EXPECT_NE(source1->GetWebContents()->GetRenderProcessHost()->GetID(), | |
293 browser()->tab_strip_model()->GetWebContentsAt(0)-> | |
294 GetRenderProcessHost()->GetID()); | |
295 EXPECT_NE(source3->GetWebContents()->GetRenderProcessHost()->GetID(), | |
296 browser()->tab_strip_model()->GetWebContentsAt(0)-> | |
297 GetRenderProcessHost()->GetID()); | |
298 | |
299 // Check that the storage partitions of the first two tags match and are | |
300 // different than the other two. | |
301 EXPECT_EQ( | |
302 source1->GetWebContents()->GetRenderProcessHost()-> | |
303 GetStoragePartition(), | |
304 source2->GetWebContents()->GetRenderProcessHost()-> | |
305 GetStoragePartition()); | |
306 EXPECT_EQ( | |
307 source3->GetWebContents()->GetRenderProcessHost()-> | |
308 GetStoragePartition(), | |
309 source4->GetWebContents()->GetRenderProcessHost()-> | |
310 GetStoragePartition()); | |
311 EXPECT_NE( | |
312 source1->GetWebContents()->GetRenderProcessHost()-> | |
313 GetStoragePartition(), | |
314 source3->GetWebContents()->GetRenderProcessHost()-> | |
315 GetStoragePartition()); | |
316 | |
317 // Ensure the persistent storage partitions are different. | |
318 EXPECT_EQ( | |
319 source5->GetWebContents()->GetRenderProcessHost()-> | |
320 GetStoragePartition(), | |
321 source6->GetWebContents()->GetRenderProcessHost()-> | |
322 GetStoragePartition()); | |
323 EXPECT_NE( | |
324 source5->GetWebContents()->GetRenderProcessHost()-> | |
325 GetStoragePartition(), | |
326 source7->GetWebContents()->GetRenderProcessHost()-> | |
327 GetStoragePartition()); | |
328 EXPECT_NE( | |
329 source1->GetWebContents()->GetRenderProcessHost()-> | |
330 GetStoragePartition(), | |
331 source5->GetWebContents()->GetRenderProcessHost()-> | |
332 GetStoragePartition()); | |
333 EXPECT_NE( | |
334 source1->GetWebContents()->GetRenderProcessHost()-> | |
335 GetStoragePartition(), | |
336 source7->GetWebContents()->GetRenderProcessHost()-> | |
337 GetStoragePartition()); | |
338 | |
339 *default_tag_contents1 = source1->GetWebContents(); | |
340 *default_tag_contents2 = source2->GetWebContents(); | |
341 *named_partition_contents1 = source3->GetWebContents(); | |
342 *named_partition_contents2 = source4->GetWebContents(); | |
343 if (persistent_partition_contents1) { | |
344 *persistent_partition_contents1 = source5->GetWebContents(); | |
345 } | |
346 if (persistent_partition_contents2) { | |
347 *persistent_partition_contents2 = source6->GetWebContents(); | |
348 } | |
349 if (persistent_partition_contents3) { | |
350 *persistent_partition_contents3 = source7->GetWebContents(); | |
351 } | |
352 } | |
353 | |
354 void ExecuteScriptWaitForTitle(content::WebContents* web_contents, | |
355 const char* script, | |
356 const char* title) { | |
357 string16 expected_title(ASCIIToUTF16(title)); | |
358 string16 error_title(ASCIIToUTF16("error")); | |
359 | |
360 content::TitleWatcher title_watcher(web_contents, expected_title); | |
361 title_watcher.AlsoWaitForTitle(error_title); | |
362 EXPECT_TRUE(content::ExecuteScript(web_contents, script)); | |
363 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | |
364 } | |
365 | |
366 // Handles |request| by serving a redirect response. | |
367 static scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( | |
368 const std::string& path, | |
369 const GURL& redirect_target, | |
370 const net::test_server::HttpRequest& request) { | |
371 if (!StartsWithASCII(path, request.relative_url, true)) | |
372 return scoped_ptr<net::test_server::HttpResponse>(); | |
373 | |
374 scoped_ptr<net::test_server::BasicHttpResponse> http_response( | |
375 new net::test_server::BasicHttpResponse); | |
376 http_response->set_code(net::HTTP_MOVED_PERMANENTLY); | |
377 http_response->AddCustomHeader("Location", redirect_target.spec()); | |
378 return http_response.PassAs<net::test_server::HttpResponse>(); | |
379 } | |
380 | |
381 // Handles |request| by serving an empty response. | |
382 static scoped_ptr<net::test_server::HttpResponse> EmptyResponseHandler( | |
383 const std::string& path, | |
384 const net::test_server::HttpRequest& request) { | |
385 if (StartsWithASCII(path, request.relative_url, true)) { | |
386 return scoped_ptr<net::test_server::HttpResponse>( | |
387 new EmptyHttpResponse); | |
388 } | |
389 | |
390 return scoped_ptr<net::test_server::HttpResponse>(); | |
391 } | |
392 | |
393 void TestHelper(const std::string& test_name, | |
394 const std::string& test_passed_msg, | |
395 const std::string& test_failed_msg, | |
396 const std::string& app_location) { | |
397 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. | |
398 ExtensionTestMessageListener launched_listener("Launched", false); | |
399 LoadAndLaunchPlatformApp(app_location.c_str()); | |
400 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | |
401 | |
402 embedded_test_server()->RegisterRequestHandler( | |
403 base::Bind(&WebViewTest::RedirectResponseHandler, | |
404 kRedirectResponsePath, | |
405 embedded_test_server()->GetURL(kRedirectResponseFullPath))); | |
406 | |
407 embedded_test_server()->RegisterRequestHandler( | |
408 base::Bind(&WebViewTest::EmptyResponseHandler, kEmptyResponsePath)); | |
409 | |
410 content::WebContents* embedder_web_contents = | |
411 GetFirstShellWindowWebContents(); | |
412 ASSERT_TRUE(embedder_web_contents); | |
413 | |
414 ExtensionTestMessageListener done_listener(test_passed_msg, false); | |
415 done_listener.AlsoListenForFailureMessage(test_failed_msg); | |
416 EXPECT_TRUE(content::ExecuteScript( | |
417 embedder_web_contents, | |
418 base::StringPrintf("runTest('%s')", test_name.c_str()))); | |
419 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); | |
420 } | |
421 | |
422 content::WebContents* LoadGuest(const std::string& guest_path, | |
423 const std::string& app_path) { | |
424 GURL::Replacements replace_host; | |
425 std::string host_str("localhost"); // Must stay in scope with replace_host. | |
426 replace_host.SetHostStr(host_str); | |
427 | |
428 GURL guest_url = embedded_test_server()->GetURL(guest_path); | |
429 guest_url = guest_url.ReplaceComponents(replace_host); | |
430 | |
431 ui_test_utils::UrlLoadObserver guest_observer( | |
432 guest_url, content::NotificationService::AllSources()); | |
433 | |
434 ExtensionTestMessageListener guest_loaded_listener("guest-loaded", false); | |
435 LoadAndLaunchPlatformApp(app_path.c_str()); | |
436 guest_observer.Wait(); | |
437 | |
438 content::Source<content::NavigationController> source = | |
439 guest_observer.source(); | |
440 EXPECT_TRUE(source->GetWebContents()->GetRenderProcessHost()->IsGuest()); | |
441 | |
442 bool satisfied = guest_loaded_listener.WaitUntilSatisfied(); | |
443 if (!satisfied) | |
444 return NULL; | |
445 | |
446 content::WebContents* guest_web_contents = source->GetWebContents(); | |
447 return guest_web_contents; | |
448 } | |
449 | |
450 // Runs media_access/allow tests. | |
451 void MediaAccessAPIAllowTestHelper(const std::string& test_name); | |
452 | |
453 // Runs media_access/deny tests, each of them are run separately otherwise | |
454 // they timeout (mostly on Windows). | |
455 void MediaAccessAPIDenyTestHelper(const std::string& test_name) { | |
456 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. | |
457 ExtensionTestMessageListener loaded_listener("loaded", false); | |
458 LoadAndLaunchPlatformApp("web_view/media_access/deny"); | |
459 ASSERT_TRUE(loaded_listener.WaitUntilSatisfied()); | |
460 | |
461 content::WebContents* embedder_web_contents = | |
462 GetFirstShellWindowWebContents(); | |
463 ASSERT_TRUE(embedder_web_contents); | |
464 | |
465 ExtensionTestMessageListener test_run_listener("PASSED", false); | |
466 test_run_listener.AlsoListenForFailureMessage("FAILED"); | |
467 EXPECT_TRUE( | |
468 content::ExecuteScript( | |
469 embedder_web_contents, | |
470 base::StringPrintf("startDenyTest('%s')", test_name.c_str()))); | |
471 ASSERT_TRUE(test_run_listener.WaitUntilSatisfied()); | |
472 } | |
473 | |
474 private: | |
475 scoped_ptr<content::FakeSpeechRecognitionManager> | |
476 fake_speech_recognition_manager_; | |
477 }; | |
478 | |
479 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestSize) { | |
480 TestHelper("testSize", | |
481 "DoneShimTest.PASSED", | |
482 "DoneShimTest.FAILED", | |
483 "web_view/shim"); | |
484 } | |
485 | |
486 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeAfterNavigation) { | |
487 TestHelper("testAutosizeAfterNavigation", | |
488 "DoneShimTest.PASSED", | |
489 "DoneShimTest.FAILED", | |
490 "web_view/shim"); | |
491 } | |
492 | |
493 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeBeforeNavigation) { | |
494 TestHelper("testAutosizeBeforeNavigation", | |
495 "DoneShimTest.PASSED", | |
496 "DoneShimTest.FAILED", | |
497 "web_view/shim"); | |
498 } | |
499 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeRemoveAttributes) { | |
500 TestHelper("testAutosizeRemoveAttributes", | |
501 "DoneShimTest.PASSED", | |
502 "DoneShimTest.FAILED", | |
503 "web_view/shim"); | |
504 } | |
505 | |
506 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAutosizeWithPartialAttributes) { | |
507 TestHelper("testAutosizeWithPartialAttributes", | |
508 "DoneShimTest.PASSED", | |
509 "DoneShimTest.FAILED", | |
510 "web_view/shim"); | |
511 } | |
512 | |
513 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAPIMethodExistence) { | |
514 TestHelper("testAPIMethodExistence", | |
515 "DoneShimTest.PASSED", | |
516 "DoneShimTest.FAILED", | |
517 "web_view/shim"); | |
518 } | |
519 | |
520 // Tests the existence of WebRequest API event objects on the request | |
521 // object, on the webview element, and hanging directly off webview. | |
522 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPIExistence) { | |
523 TestHelper("testWebRequestAPIExistence", | |
524 "DoneShimTest.PASSED", | |
525 "DoneShimTest.FAILED", | |
526 "web_view/shim"); | |
527 } | |
528 | |
529 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestEventName) { | |
530 TestHelper("testEventName", | |
531 "DoneShimTest.PASSED", | |
532 "DoneShimTest.FAILED", | |
533 "web_view/shim"); | |
534 } | |
535 | |
536 // WebViewTest.Shim_TestDestroyOnEventListener is flaky, so disable it. | |
537 // http://crbug.com/255106 | |
538 IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_Shim_TestDestroyOnEventListener) { | |
539 TestHelper("testDestroyOnEventListener", | |
540 "DoneShimTest.PASSED", | |
541 "DoneShimTest.FAILED", | |
542 "web_view/shim"); | |
543 } | |
544 | |
545 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestCannotMutateEventName) { | |
546 TestHelper("testCannotMutateEventName", | |
547 "DoneShimTest.PASSED", | |
548 "DoneShimTest.FAILED", | |
549 "web_view/shim"); | |
550 } | |
551 | |
552 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestPartitionRaisesException) { | |
553 #if defined(OS_WIN) | |
554 // Flaky on XP bot http://crbug.com/267304 | |
555 if (base::win::GetVersion() <= base::win::VERSION_XP) | |
556 return; | |
557 #endif | |
558 | |
559 TestHelper("testPartitionRaisesException", | |
560 "DoneShimTest.PASSED", | |
561 "DoneShimTest.FAILED", | |
562 "web_view/shim"); | |
563 } | |
564 | |
565 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestExecuteScriptFail) { | |
566 #if defined(OS_WIN) | |
567 // Flaky on XP bot http://crbug.com/266185 | |
568 if (base::win::GetVersion() <= base::win::VERSION_XP) | |
569 return; | |
570 #endif | |
571 | |
572 TestHelper("testExecuteScriptFail", | |
573 "DoneShimTest.PASSED", | |
574 "DoneShimTest.FAILED", | |
575 "web_view/shim"); | |
576 } | |
577 | |
578 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestExecuteScript) { | |
579 TestHelper("testExecuteScript", | |
580 "DoneShimTest.PASSED", | |
581 "DoneShimTest.FAILED", | |
582 "web_view/shim"); | |
583 } | |
584 | |
585 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestTerminateAfterExit) { | |
586 TestHelper("testTerminateAfterExit", | |
587 "DoneShimTest.PASSED", | |
588 "DoneShimTest.FAILED", | |
589 "web_view/shim"); | |
590 } | |
591 | |
592 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestAssignSrcAfterCrash) { | |
593 TestHelper("testAssignSrcAfterCrash", | |
594 "DoneShimTest.PASSED", | |
595 "DoneShimTest.FAILED", | |
596 "web_view/shim"); | |
597 } | |
598 | |
599 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveSrcAttribute) { | |
600 TestHelper("testRemoveSrcAttribute", | |
601 "DoneShimTest.PASSED", | |
602 "DoneShimTest.FAILED", | |
603 "web_view/shim"); | |
604 } | |
605 | |
606 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestBrowserPluginNotAllowed) { | |
607 #if defined(OS_WIN) | |
608 // Flaky on XP bots. http://crbug.com/267300 | |
609 if (base::win::GetVersion() <= base::win::VERSION_XP) | |
610 return; | |
611 #endif | |
612 | |
613 TestHelper("testBrowserPluginNotAllowed", | |
614 "DoneShimTest.PASSED", | |
615 "DoneShimTest.FAILED", | |
616 "web_view/shim"); | |
617 } | |
618 | |
619 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNewWindow) { | |
620 TestHelper("testNewWindow", | |
621 "DoneShimTest.PASSED", | |
622 "DoneShimTest.FAILED", | |
623 "web_view/shim"); | |
624 } | |
625 | |
626 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNewWindowTwoListeners) { | |
627 TestHelper("testNewWindowTwoListeners", | |
628 "DoneShimTest.PASSED", | |
629 "DoneShimTest.FAILED", | |
630 "web_view/shim"); | |
631 } | |
632 | |
633 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNewWindowNoPreventDefault) { | |
634 TestHelper("testNewWindowNoPreventDefault", | |
635 "DoneShimTest.PASSED", | |
636 "DoneShimTest.FAILED", | |
637 "web_view/shim"); | |
638 } | |
639 | |
640 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestNewWindowNoReferrerLink) { | |
641 TestHelper("testNewWindowNoReferrerLink", | |
642 "DoneShimTest.PASSED", | |
643 "DoneShimTest.FAILED", | |
644 "web_view/shim"); | |
645 } | |
646 | |
647 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestContentLoadEvent) { | |
648 TestHelper("testContentLoadEvent", | |
649 "DoneShimTest.PASSED", | |
650 "DoneShimTest.FAILED", | |
651 "web_view/shim"); | |
652 } | |
653 | |
654 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestWebRequestAPI) { | |
655 TestHelper("testWebRequestAPI", | |
656 "DoneShimTest.PASSED", | |
657 "DoneShimTest.FAILED", | |
658 "web_view/shim"); | |
659 } | |
660 | |
661 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadStartLoadRedirect) { | |
662 TestHelper("testLoadStartLoadRedirect", | |
663 "DoneShimTest.PASSED", | |
664 "DoneShimTest.FAILED", | |
665 "web_view/shim"); | |
666 } | |
667 | |
668 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortEmptyResponse) { | |
669 TestHelper("testLoadAbortEmptyResponse", | |
670 "DoneShimTest.PASSED", | |
671 "DoneShimTest.FAILED", | |
672 "web_view/shim"); | |
673 } | |
674 | |
675 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortIllegalChromeURL) { | |
676 TestHelper("testLoadAbortIllegalChromeURL", | |
677 "DoneShimTest.PASSED", | |
678 "DoneShimTest.FAILED", | |
679 "web_view/shim"); | |
680 } | |
681 | |
682 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestLoadAbortIllegalFileURL) { | |
683 TestHelper("testLoadAbortIllegalFileURL", | |
684 "DoneShimTest.PASSED", | |
685 "DoneShimTest.FAILED", | |
686 "web_view/shim"); | |
687 } | |
688 | |
689 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestReload) { | |
690 TestHelper("testReload", | |
691 "DoneShimTest.PASSED", | |
692 "DoneShimTest.FAILED", | |
693 "web_view/shim"); | |
694 } | |
695 | |
696 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestGetProcessId) { | |
697 TestHelper("testGetProcessId", | |
698 "DoneShimTest.PASSED", | |
699 "DoneShimTest.FAILED", | |
700 "web_view/shim"); | |
701 } | |
702 | |
703 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveWebviewOnExit) { | |
704 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. | |
705 | |
706 // Launch the app and wait until it's ready to load a test. | |
707 ExtensionTestMessageListener launched_listener("Launched", false); | |
708 LoadAndLaunchPlatformApp("web_view/shim"); | |
709 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | |
710 | |
711 content::WebContents* embedder_web_contents = | |
712 GetFirstShellWindowWebContents(); | |
713 ASSERT_TRUE(embedder_web_contents); | |
714 | |
715 GURL::Replacements replace_host; | |
716 std::string host_str("localhost"); // Must stay in scope with replace_host. | |
717 replace_host.SetHostStr(host_str); | |
718 | |
719 std::string guest_path( | |
720 "/extensions/platform_apps/web_view/shim/empty_guest.html"); | |
721 GURL guest_url = embedded_test_server()->GetURL(guest_path); | |
722 guest_url = guest_url.ReplaceComponents(replace_host); | |
723 | |
724 ui_test_utils::UrlLoadObserver guest_observer( | |
725 guest_url, content::NotificationService::AllSources()); | |
726 | |
727 // Run the test and wait until the guest WebContents is available and has | |
728 // finished loading. | |
729 ExtensionTestMessageListener guest_loaded_listener("guest-loaded", false); | |
730 EXPECT_TRUE(content::ExecuteScript( | |
731 embedder_web_contents, | |
732 "runTest('testRemoveWebviewOnExit')")); | |
733 guest_observer.Wait(); | |
734 | |
735 content::Source<content::NavigationController> source = | |
736 guest_observer.source(); | |
737 EXPECT_TRUE(source->GetWebContents()->GetRenderProcessHost()->IsGuest()); | |
738 | |
739 ASSERT_TRUE(guest_loaded_listener.WaitUntilSatisfied()); | |
740 | |
741 content::WindowedNotificationObserver observer( | |
742 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | |
743 content::Source<content::WebContents>(source->GetWebContents())); | |
744 | |
745 // Tell the embedder to kill the guest. | |
746 EXPECT_TRUE(content::ExecuteScript( | |
747 embedder_web_contents, | |
748 "removeWebviewOnExitDoCrash();")); | |
749 | |
750 // Wait until the guest WebContents is destroyed. | |
751 observer.Wait(); | |
752 } | |
753 | |
754 IN_PROC_BROWSER_TEST_F(WebViewTest, ShimSrcAttribute) { | |
755 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/src_attribute")) | |
756 << message_; | |
757 } | |
758 | |
759 // This test verifies that prerendering has been disabled inside <webview>. | |
760 // This test is here rather than in PrerenderBrowserTest for testing convenience | |
761 // only. If it breaks then this is a bug in the prerenderer. | |
762 IN_PROC_BROWSER_TEST_F(WebViewTest, NoPrerenderer) { | |
763 ASSERT_TRUE(StartEmbeddedTestServer()); | |
764 content::WebContents* guest_web_contents = | |
765 LoadGuest( | |
766 "/extensions/platform_apps/web_view/noprerenderer/guest.html", | |
767 "web_view/noprerenderer"); | |
768 ASSERT_TRUE(guest_web_contents != NULL); | |
769 | |
770 PrerenderLinkManager* prerender_link_manager = | |
771 PrerenderLinkManagerFactory::GetForProfile( | |
772 Profile::FromBrowserContext(guest_web_contents->GetBrowserContext())); | |
773 ASSERT_TRUE(prerender_link_manager != NULL); | |
774 EXPECT_TRUE(prerender_link_manager->IsEmpty()); | |
775 } | |
776 | |
777 // This tests cookie isolation for packaged apps with webview tags. It navigates | |
778 // the main browser window to a page that sets a cookie and loads an app with | |
779 // multiple webview tags. Each tag sets a cookie and the test checks the proper | |
780 // storage isolation is enforced. | |
781 IN_PROC_BROWSER_TEST_F(WebViewTest, CookieIsolation) { | |
782 ASSERT_TRUE(StartEmbeddedTestServer()); | |
783 const std::string kExpire = | |
784 "var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);"; | |
785 std::string cookie_script1(kExpire); | |
786 cookie_script1.append( | |
787 "document.cookie = 'guest1=true; path=/; expires=' + expire + ';';"); | |
788 std::string cookie_script2(kExpire); | |
789 cookie_script2.append( | |
790 "document.cookie = 'guest2=true; path=/; expires=' + expire + ';';"); | |
791 | |
792 GURL::Replacements replace_host; | |
793 std::string host_str("localhost"); // Must stay in scope with replace_host. | |
794 replace_host.SetHostStr(host_str); | |
795 | |
796 GURL set_cookie_url = embedded_test_server()->GetURL( | |
797 "/extensions/platform_apps/isolation/set_cookie.html"); | |
798 set_cookie_url = set_cookie_url.ReplaceComponents(replace_host); | |
799 | |
800 // The first two partitions will be used to set cookies and ensure they are | |
801 // shared. The named partition is used to ensure that cookies are isolated | |
802 // between partitions within the same app. | |
803 content::WebContents* cookie_contents1; | |
804 content::WebContents* cookie_contents2; | |
805 content::WebContents* named_partition_contents1; | |
806 content::WebContents* named_partition_contents2; | |
807 | |
808 NavigateAndOpenAppForIsolation(set_cookie_url, &cookie_contents1, | |
809 &cookie_contents2, &named_partition_contents1, | |
810 &named_partition_contents2, NULL, NULL, NULL); | |
811 | |
812 EXPECT_TRUE(content::ExecuteScript(cookie_contents1, cookie_script1)); | |
813 EXPECT_TRUE(content::ExecuteScript(cookie_contents2, cookie_script2)); | |
814 | |
815 int cookie_size; | |
816 std::string cookie_value; | |
817 | |
818 // Test the regular browser context to ensure we have only one cookie. | |
819 automation_util::GetCookies(GURL("http://localhost"), | |
820 browser()->tab_strip_model()->GetWebContentsAt(0), | |
821 &cookie_size, &cookie_value); | |
822 EXPECT_EQ("testCookie=1", cookie_value); | |
823 | |
824 // The default behavior is to combine webview tags with no explicit partition | |
825 // declaration into the same in-memory partition. Test the webview tags to | |
826 // ensure we have properly set the cookies and we have both cookies in both | |
827 // tags. | |
828 automation_util::GetCookies(GURL("http://localhost"), | |
829 cookie_contents1, | |
830 &cookie_size, &cookie_value); | |
831 EXPECT_EQ("guest1=true; guest2=true", cookie_value); | |
832 | |
833 automation_util::GetCookies(GURL("http://localhost"), | |
834 cookie_contents2, | |
835 &cookie_size, &cookie_value); | |
836 EXPECT_EQ("guest1=true; guest2=true", cookie_value); | |
837 | |
838 // The third tag should not have any cookies as it is in a separate partition. | |
839 automation_util::GetCookies(GURL("http://localhost"), | |
840 named_partition_contents1, | |
841 &cookie_size, &cookie_value); | |
842 EXPECT_EQ("", cookie_value); | |
843 } | |
844 | |
845 // This tests that in-memory storage partitions are reset on browser restart, | |
846 // but persistent ones maintain state for cookies and HTML5 storage. | |
847 IN_PROC_BROWSER_TEST_F(WebViewTest, PRE_StoragePersistence) { | |
848 ASSERT_TRUE(StartEmbeddedTestServer()); | |
849 const std::string kExpire = | |
850 "var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);"; | |
851 std::string cookie_script1(kExpire); | |
852 cookie_script1.append( | |
853 "document.cookie = 'inmemory=true; path=/; expires=' + expire + ';';"); | |
854 std::string cookie_script2(kExpire); | |
855 cookie_script2.append( | |
856 "document.cookie = 'persist1=true; path=/; expires=' + expire + ';';"); | |
857 std::string cookie_script3(kExpire); | |
858 cookie_script3.append( | |
859 "document.cookie = 'persist2=true; path=/; expires=' + expire + ';';"); | |
860 | |
861 // We don't care where the main browser is on this test. | |
862 GURL blank_url("about:blank"); | |
863 | |
864 // The first two partitions will be used to set cookies and ensure they are | |
865 // shared. The named partition is used to ensure that cookies are isolated | |
866 // between partitions within the same app. | |
867 content::WebContents* cookie_contents1; | |
868 content::WebContents* cookie_contents2; | |
869 content::WebContents* named_partition_contents1; | |
870 content::WebContents* named_partition_contents2; | |
871 content::WebContents* persistent_partition_contents1; | |
872 content::WebContents* persistent_partition_contents2; | |
873 content::WebContents* persistent_partition_contents3; | |
874 NavigateAndOpenAppForIsolation(blank_url, &cookie_contents1, | |
875 &cookie_contents2, &named_partition_contents1, | |
876 &named_partition_contents2, | |
877 &persistent_partition_contents1, | |
878 &persistent_partition_contents2, | |
879 &persistent_partition_contents3); | |
880 | |
881 // Set the inmemory=true cookie for tags with inmemory partitions. | |
882 EXPECT_TRUE(content::ExecuteScript(cookie_contents1, cookie_script1)); | |
883 EXPECT_TRUE(content::ExecuteScript(named_partition_contents1, | |
884 cookie_script1)); | |
885 | |
886 // For the two different persistent storage partitions, set the | |
887 // two different cookies so we can check that they aren't comingled below. | |
888 EXPECT_TRUE(content::ExecuteScript(persistent_partition_contents1, | |
889 cookie_script2)); | |
890 | |
891 EXPECT_TRUE(content::ExecuteScript(persistent_partition_contents3, | |
892 cookie_script3)); | |
893 | |
894 int cookie_size; | |
895 std::string cookie_value; | |
896 | |
897 // Check that all in-memory partitions have a cookie set. | |
898 automation_util::GetCookies(GURL("http://localhost"), | |
899 cookie_contents1, | |
900 &cookie_size, &cookie_value); | |
901 EXPECT_EQ("inmemory=true", cookie_value); | |
902 automation_util::GetCookies(GURL("http://localhost"), | |
903 cookie_contents2, | |
904 &cookie_size, &cookie_value); | |
905 EXPECT_EQ("inmemory=true", cookie_value); | |
906 automation_util::GetCookies(GURL("http://localhost"), | |
907 named_partition_contents1, | |
908 &cookie_size, &cookie_value); | |
909 EXPECT_EQ("inmemory=true", cookie_value); | |
910 automation_util::GetCookies(GURL("http://localhost"), | |
911 named_partition_contents2, | |
912 &cookie_size, &cookie_value); | |
913 EXPECT_EQ("inmemory=true", cookie_value); | |
914 | |
915 // Check that all persistent partitions kept their state. | |
916 automation_util::GetCookies(GURL("http://localhost"), | |
917 persistent_partition_contents1, | |
918 &cookie_size, &cookie_value); | |
919 EXPECT_EQ("persist1=true", cookie_value); | |
920 automation_util::GetCookies(GURL("http://localhost"), | |
921 persistent_partition_contents2, | |
922 &cookie_size, &cookie_value); | |
923 EXPECT_EQ("persist1=true", cookie_value); | |
924 automation_util::GetCookies(GURL("http://localhost"), | |
925 persistent_partition_contents3, | |
926 &cookie_size, &cookie_value); | |
927 EXPECT_EQ("persist2=true", cookie_value); | |
928 } | |
929 | |
930 // This is the post-reset portion of the StoragePersistence test. See | |
931 // PRE_StoragePersistence for main comment. | |
932 IN_PROC_BROWSER_TEST_F(WebViewTest, DISABLED_StoragePersistence) { | |
933 ASSERT_TRUE(StartEmbeddedTestServer()); | |
934 | |
935 // We don't care where the main browser is on this test. | |
936 GURL blank_url("about:blank"); | |
937 | |
938 // The first two partitions will be used to set cookies and ensure they are | |
939 // shared. The named partition is used to ensure that cookies are isolated | |
940 // between partitions within the same app. | |
941 content::WebContents* cookie_contents1; | |
942 content::WebContents* cookie_contents2; | |
943 content::WebContents* named_partition_contents1; | |
944 content::WebContents* named_partition_contents2; | |
945 content::WebContents* persistent_partition_contents1; | |
946 content::WebContents* persistent_partition_contents2; | |
947 content::WebContents* persistent_partition_contents3; | |
948 NavigateAndOpenAppForIsolation(blank_url, &cookie_contents1, | |
949 &cookie_contents2, &named_partition_contents1, | |
950 &named_partition_contents2, | |
951 &persistent_partition_contents1, | |
952 &persistent_partition_contents2, | |
953 &persistent_partition_contents3); | |
954 | |
955 int cookie_size; | |
956 std::string cookie_value; | |
957 | |
958 // Check that all in-memory partitions lost their state. | |
959 automation_util::GetCookies(GURL("http://localhost"), | |
960 cookie_contents1, | |
961 &cookie_size, &cookie_value); | |
962 EXPECT_EQ("", cookie_value); | |
963 automation_util::GetCookies(GURL("http://localhost"), | |
964 cookie_contents2, | |
965 &cookie_size, &cookie_value); | |
966 EXPECT_EQ("", cookie_value); | |
967 automation_util::GetCookies(GURL("http://localhost"), | |
968 named_partition_contents1, | |
969 &cookie_size, &cookie_value); | |
970 EXPECT_EQ("", cookie_value); | |
971 automation_util::GetCookies(GURL("http://localhost"), | |
972 named_partition_contents2, | |
973 &cookie_size, &cookie_value); | |
974 EXPECT_EQ("", cookie_value); | |
975 | |
976 // Check that all persistent partitions kept their state. | |
977 automation_util::GetCookies(GURL("http://localhost"), | |
978 persistent_partition_contents1, | |
979 &cookie_size, &cookie_value); | |
980 EXPECT_EQ("persist1=true", cookie_value); | |
981 automation_util::GetCookies(GURL("http://localhost"), | |
982 persistent_partition_contents2, | |
983 &cookie_size, &cookie_value); | |
984 EXPECT_EQ("persist1=true", cookie_value); | |
985 automation_util::GetCookies(GURL("http://localhost"), | |
986 persistent_partition_contents3, | |
987 &cookie_size, &cookie_value); | |
988 EXPECT_EQ("persist2=true", cookie_value); | |
989 } | |
990 | |
991 #if defined(OS_WIN) | |
992 // This test is very flaky on Win Aura, Win XP, Win 7. http://crbug.com/248873 | |
993 #define MAYBE_DOMStorageIsolation DISABLED_DOMStorageIsolation | |
994 #else | |
995 #define MAYBE_DOMStorageIsolation DOMStorageIsolation | |
996 #endif | |
997 | |
998 // This tests DOM storage isolation for packaged apps with webview tags. It | |
999 // loads an app with multiple webview tags and each tag sets DOM storage | |
1000 // entries, which the test checks to ensure proper storage isolation is | |
1001 // enforced. | |
1002 IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_DOMStorageIsolation) { | |
1003 ASSERT_TRUE(StartEmbeddedTestServer()); | |
1004 GURL regular_url = embedded_test_server()->GetURL("/title1.html"); | |
1005 | |
1006 std::string output; | |
1007 std::string get_local_storage("window.domAutomationController.send(" | |
1008 "window.localStorage.getItem('foo') || 'badval')"); | |
1009 std::string get_session_storage("window.domAutomationController.send(" | |
1010 "window.sessionStorage.getItem('bar') || 'badval')"); | |
1011 | |
1012 content::WebContents* default_tag_contents1; | |
1013 content::WebContents* default_tag_contents2; | |
1014 content::WebContents* storage_contents1; | |
1015 content::WebContents* storage_contents2; | |
1016 | |
1017 NavigateAndOpenAppForIsolation(regular_url, &default_tag_contents1, | |
1018 &default_tag_contents2, &storage_contents1, | |
1019 &storage_contents2, NULL, NULL, NULL); | |
1020 | |
1021 // Initialize the storage for the first of the two tags that share a storage | |
1022 // partition. | |
1023 EXPECT_TRUE(content::ExecuteScript(storage_contents1, | |
1024 "initDomStorage('page1')")); | |
1025 | |
1026 // Let's test that the expected values are present in the first tag, as they | |
1027 // will be overwritten once we call the initDomStorage on the second tag. | |
1028 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents1, | |
1029 get_local_storage.c_str(), | |
1030 &output)); | |
1031 EXPECT_STREQ("local-page1", output.c_str()); | |
1032 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents1, | |
1033 get_session_storage.c_str(), | |
1034 &output)); | |
1035 EXPECT_STREQ("session-page1", output.c_str()); | |
1036 | |
1037 // Now, init the storage in the second tag in the same storage partition, | |
1038 // which will overwrite the shared localStorage. | |
1039 EXPECT_TRUE(content::ExecuteScript(storage_contents2, | |
1040 "initDomStorage('page2')")); | |
1041 | |
1042 // The localStorage value now should reflect the one written through the | |
1043 // second tag. | |
1044 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents1, | |
1045 get_local_storage.c_str(), | |
1046 &output)); | |
1047 EXPECT_STREQ("local-page2", output.c_str()); | |
1048 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents2, | |
1049 get_local_storage.c_str(), | |
1050 &output)); | |
1051 EXPECT_STREQ("local-page2", output.c_str()); | |
1052 | |
1053 // Session storage is not shared though, as each webview tag has separate | |
1054 // instance, even if they are in the same storage partition. | |
1055 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents1, | |
1056 get_session_storage.c_str(), | |
1057 &output)); | |
1058 EXPECT_STREQ("session-page1", output.c_str()); | |
1059 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents2, | |
1060 get_session_storage.c_str(), | |
1061 &output)); | |
1062 EXPECT_STREQ("session-page2", output.c_str()); | |
1063 | |
1064 // Also, let's check that the main browser and another tag that doesn't share | |
1065 // the same partition don't have those values stored. | |
1066 EXPECT_TRUE(ExecuteScriptAndExtractString( | |
1067 browser()->tab_strip_model()->GetWebContentsAt(0), | |
1068 get_local_storage.c_str(), | |
1069 &output)); | |
1070 EXPECT_STREQ("badval", output.c_str()); | |
1071 EXPECT_TRUE(ExecuteScriptAndExtractString( | |
1072 browser()->tab_strip_model()->GetWebContentsAt(0), | |
1073 get_session_storage.c_str(), | |
1074 &output)); | |
1075 EXPECT_STREQ("badval", output.c_str()); | |
1076 EXPECT_TRUE(ExecuteScriptAndExtractString(default_tag_contents1, | |
1077 get_local_storage.c_str(), | |
1078 &output)); | |
1079 EXPECT_STREQ("badval", output.c_str()); | |
1080 EXPECT_TRUE(ExecuteScriptAndExtractString(default_tag_contents1, | |
1081 get_session_storage.c_str(), | |
1082 &output)); | |
1083 EXPECT_STREQ("badval", output.c_str()); | |
1084 } | |
1085 | |
1086 // See crbug.com/248500 | |
1087 #if defined(OS_WIN) | |
1088 #define MAYBE_IndexedDBIsolation DISABLED_IndexedDBIsolation | |
1089 #else | |
1090 #define MAYBE_IndexedDBIsolation IndexedDBIsolation | |
1091 #endif | |
1092 | |
1093 // This tests IndexedDB isolation for packaged apps with webview tags. It loads | |
1094 // an app with multiple webview tags and each tag creates an IndexedDB record, | |
1095 // which the test checks to ensure proper storage isolation is enforced. | |
1096 IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_IndexedDBIsolation) { | |
1097 ASSERT_TRUE(StartEmbeddedTestServer()); | |
1098 GURL regular_url = embedded_test_server()->GetURL("/title1.html"); | |
1099 | |
1100 content::WebContents* default_tag_contents1; | |
1101 content::WebContents* default_tag_contents2; | |
1102 content::WebContents* storage_contents1; | |
1103 content::WebContents* storage_contents2; | |
1104 | |
1105 NavigateAndOpenAppForIsolation(regular_url, &default_tag_contents1, | |
1106 &default_tag_contents2, &storage_contents1, | |
1107 &storage_contents2, NULL, NULL, NULL); | |
1108 | |
1109 // Initialize the storage for the first of the two tags that share a storage | |
1110 // partition. | |
1111 ExecuteScriptWaitForTitle(storage_contents1, "initIDB()", "idb created"); | |
1112 ExecuteScriptWaitForTitle(storage_contents1, "addItemIDB(7, 'page1')", | |
1113 "addItemIDB complete"); | |
1114 ExecuteScriptWaitForTitle(storage_contents1, "readItemIDB(7)", | |
1115 "readItemIDB complete"); | |
1116 | |
1117 std::string output; | |
1118 std::string get_value( | |
1119 "window.domAutomationController.send(getValueIDB() || 'badval')"); | |
1120 | |
1121 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents1, | |
1122 get_value.c_str(), &output)); | |
1123 EXPECT_STREQ("page1", output.c_str()); | |
1124 | |
1125 // Initialize the db in the second tag. | |
1126 ExecuteScriptWaitForTitle(storage_contents2, "initIDB()", "idb open"); | |
1127 | |
1128 // Since we share a partition, reading the value should return the existing | |
1129 // one. | |
1130 ExecuteScriptWaitForTitle(storage_contents2, "readItemIDB(7)", | |
1131 "readItemIDB complete"); | |
1132 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents2, | |
1133 get_value.c_str(), &output)); | |
1134 EXPECT_STREQ("page1", output.c_str()); | |
1135 | |
1136 // Now write through the second tag and read it back. | |
1137 ExecuteScriptWaitForTitle(storage_contents2, "addItemIDB(7, 'page2')", | |
1138 "addItemIDB complete"); | |
1139 ExecuteScriptWaitForTitle(storage_contents2, "readItemIDB(7)", | |
1140 "readItemIDB complete"); | |
1141 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents2, | |
1142 get_value.c_str(), &output)); | |
1143 EXPECT_STREQ("page2", output.c_str()); | |
1144 | |
1145 // Reset the document title, otherwise the next call will not see a change and | |
1146 // will hang waiting for it. | |
1147 EXPECT_TRUE(content::ExecuteScript(storage_contents1, | |
1148 "document.title = 'foo'")); | |
1149 | |
1150 // Read through the first tag to ensure we have the second value. | |
1151 ExecuteScriptWaitForTitle(storage_contents1, "readItemIDB(7)", | |
1152 "readItemIDB complete"); | |
1153 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents1, | |
1154 get_value.c_str(), &output)); | |
1155 EXPECT_STREQ("page2", output.c_str()); | |
1156 | |
1157 // Now, let's confirm there is no database in the main browser and another | |
1158 // tag that doesn't share the same partition. Due to the IndexedDB API design, | |
1159 // open will succeed, but the version will be 1, since it creates the database | |
1160 // if it is not found. The two tags use database version 3, so we avoid | |
1161 // ambiguity. | |
1162 const char* script = | |
1163 "indexedDB.open('isolation').onsuccess = function(e) {" | |
1164 " if (e.target.result.version == 1)" | |
1165 " document.title = 'db not found';" | |
1166 " else " | |
1167 " document.title = 'error';" | |
1168 "}"; | |
1169 ExecuteScriptWaitForTitle(browser()->tab_strip_model()->GetWebContentsAt(0), | |
1170 script, "db not found"); | |
1171 ExecuteScriptWaitForTitle(default_tag_contents1, script, "db not found"); | |
1172 } | |
1173 | |
1174 // This test ensures that closing app window on 'loadcommit' does not crash. | |
1175 // The test launches an app with guest and closes the window on loadcommit. It | |
1176 // then launches the app window again. The process is repeated 3 times. | |
1177 IN_PROC_BROWSER_TEST_F(WebViewTest, CloseOnLoadcommit) { | |
1178 ExtensionTestMessageListener done_test_listener( | |
1179 "done-close-on-loadcommit", false); | |
1180 LoadAndLaunchPlatformApp("web_view/close_on_loadcommit"); | |
1181 ASSERT_TRUE(done_test_listener.WaitUntilSatisfied()); | |
1182 } | |
1183 | |
1184 IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIDeny_TestDeny) { | |
1185 MediaAccessAPIDenyTestHelper("testDeny"); | |
1186 } | |
1187 | |
1188 IN_PROC_BROWSER_TEST_F(WebViewTest, | |
1189 MediaAccessAPIDeny_TestDenyThenAllowThrows) { | |
1190 MediaAccessAPIDenyTestHelper("testDenyThenAllowThrows"); | |
1191 | |
1192 } | |
1193 | |
1194 IN_PROC_BROWSER_TEST_F(WebViewTest, | |
1195 MediaAccessAPIDeny_TestDenyWithPreventDefault) { | |
1196 MediaAccessAPIDenyTestHelper("testDenyWithPreventDefault"); | |
1197 } | |
1198 | |
1199 IN_PROC_BROWSER_TEST_F(WebViewTest, | |
1200 MediaAccessAPIDeny_TestNoListenersImplyDeny) { | |
1201 MediaAccessAPIDenyTestHelper("testNoListenersImplyDeny"); | |
1202 } | |
1203 | |
1204 IN_PROC_BROWSER_TEST_F(WebViewTest, | |
1205 MediaAccessAPIDeny_TestNoPreventDefaultImpliesDeny) { | |
1206 MediaAccessAPIDenyTestHelper("testNoPreventDefaultImpliesDeny"); | |
1207 } | |
1208 | |
1209 void WebViewTest::MediaAccessAPIAllowTestHelper(const std::string& test_name) { | |
1210 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. | |
1211 ExtensionTestMessageListener launched_listener("Launched", false); | |
1212 LoadAndLaunchPlatformApp("web_view/media_access/allow"); | |
1213 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | |
1214 | |
1215 content::WebContents* embedder_web_contents = | |
1216 GetFirstShellWindowWebContents(); | |
1217 ASSERT_TRUE(embedder_web_contents); | |
1218 MockWebContentsDelegate* mock = new MockWebContentsDelegate; | |
1219 embedder_web_contents->SetDelegate(mock); | |
1220 | |
1221 ExtensionTestMessageListener done_listener("DoneMediaTest.PASSED", false); | |
1222 done_listener.AlsoListenForFailureMessage("DoneMediaTest.FAILED"); | |
1223 EXPECT_TRUE( | |
1224 content::ExecuteScript( | |
1225 embedder_web_contents, | |
1226 base::StringPrintf("startAllowTest('%s')", | |
1227 test_name.c_str()))); | |
1228 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); | |
1229 | |
1230 mock->WaitForSetMediaPermission(); | |
1231 } | |
1232 | |
1233 IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestAllow) { | |
1234 MediaAccessAPIAllowTestHelper("testAllow"); | |
1235 } | |
1236 | |
1237 IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestAllowAndThenDeny) { | |
1238 MediaAccessAPIAllowTestHelper("testAllowAndThenDeny"); | |
1239 } | |
1240 | |
1241 IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestAllowTwice) { | |
1242 MediaAccessAPIAllowTestHelper("testAllowTwice"); | |
1243 } | |
1244 | |
1245 IN_PROC_BROWSER_TEST_F(WebViewTest, MediaAccessAPIAllow_TestAllowAsync) { | |
1246 MediaAccessAPIAllowTestHelper("testAllowAsync"); | |
1247 } | |
1248 | |
1249 // Checks that window.screenX/screenY/screenLeft/screenTop works correctly for | |
1250 // guests. | |
1251 IN_PROC_BROWSER_TEST_F(WebViewTest, ScreenCoordinates) { | |
1252 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. | |
1253 ASSERT_TRUE(RunPlatformAppTestWithArg( | |
1254 "platform_apps/web_view/common", "screen_coordinates")) | |
1255 << message_; | |
1256 } | |
1257 | |
1258 IN_PROC_BROWSER_TEST_F(WebViewTest, SpeechRecognition) { | |
1259 ASSERT_TRUE(StartEmbeddedTestServer()); | |
1260 content::WebContents* guest_web_contents = LoadGuest( | |
1261 "/extensions/platform_apps/web_view/speech/guest.html", | |
1262 "web_view/speech"); | |
1263 ASSERT_TRUE(guest_web_contents); | |
1264 | |
1265 // Click on the guest (center of the WebContents), the guest is rendered in a | |
1266 // way that this will trigger clicking on speech recognition input mic. | |
1267 SimulateMouseClick(guest_web_contents, 0, WebKit::WebMouseEvent::ButtonLeft); | |
1268 | |
1269 string16 expected_title(ASCIIToUTF16("PASSED")); | |
1270 string16 error_title(ASCIIToUTF16("FAILED")); | |
1271 content::TitleWatcher title_watcher(guest_web_contents, expected_title); | |
1272 title_watcher.AlsoWaitForTitle(error_title); | |
1273 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | |
1274 } | |
1275 | |
1276 IN_PROC_BROWSER_TEST_F(WebViewTest, TearDownTest) { | |
1277 ExtensionTestMessageListener first_loaded_listener("guest-loaded", false); | |
1278 const extensions::Extension* extension = | |
1279 LoadAndLaunchPlatformApp("web_view/teardown"); | |
1280 ASSERT_TRUE(first_loaded_listener.WaitUntilSatisfied()); | |
1281 apps::ShellWindow* window = NULL; | |
1282 if (!GetShellWindowCount()) | |
1283 window = CreateShellWindow(extension); | |
1284 else | |
1285 window = GetFirstShellWindow(); | |
1286 CloseShellWindow(window); | |
1287 | |
1288 // Load the app again. | |
1289 ExtensionTestMessageListener second_loaded_listener("guest-loaded", false); | |
1290 LoadAndLaunchPlatformApp("web_view/teardown"); | |
1291 ASSERT_TRUE(second_loaded_listener.WaitUntilSatisfied()); | |
1292 } | |
1293 | |
1294 // In following GeolocationAPIEmbedderHasNoAccess* tests, embedder (i.e. the | |
1295 // platform app) does not have geolocation permission for this test. | |
1296 // No matter what the API does, geolocation permission would be denied. | |
1297 // Note that the test name prefix must be "GeolocationAPI". | |
1298 IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPIEmbedderHasNoAccessAllow) { | |
1299 TestHelper("testDenyDenies", | |
1300 "DoneGeolocationTest.PASSED", | |
1301 "DoneGeolocationTest.FAILED", | |
1302 "web_view/geolocation/embedder_has_no_permission"); | |
1303 } | |
1304 | |
1305 IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPIEmbedderHasNoAccessDeny) { | |
1306 TestHelper("testDenyDenies", | |
1307 "DoneGeolocationTest.PASSED", | |
1308 "DoneGeolocationTest.FAILED", | |
1309 "web_view/geolocation/embedder_has_no_permission"); | |
1310 } | |
1311 | |
1312 // In following GeolocationAPIEmbedderHasAccess* tests, embedder (i.e. the | |
1313 // platform app) has geolocation permission | |
1314 // | |
1315 // Note that these test names must be "GeolocationAPI" prefixed (b/c we mock out | |
1316 // geolocation in this case). | |
1317 // | |
1318 // Also note that these are run separately because OverrideGeolocation() doesn't | |
1319 // mock out geolocation for multiple navigator.geolocation calls properly and | |
1320 // the tests become flaky. | |
1321 // GeolocationAPI* test 1 of 3. | |
1322 IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPIEmbedderHasAccessAllow) { | |
1323 TestHelper("testAllow", | |
1324 "DoneGeolocationTest.PASSED", | |
1325 "DoneGeolocationTest.FAILED", | |
1326 "web_view/geolocation/embedder_has_permission"); | |
1327 } | |
1328 | |
1329 // GeolocationAPI* test 2 of 3. | |
1330 IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPIEmbedderHasAccessDeny) { | |
1331 TestHelper("testDeny", | |
1332 "DoneGeolocationTest.PASSED", | |
1333 "DoneGeolocationTest.FAILED", | |
1334 "web_view/geolocation/embedder_has_permission"); | |
1335 } | |
1336 | |
1337 // GeolocationAPI* test 3 of 3. | |
1338 IN_PROC_BROWSER_TEST_F(WebViewTest, | |
1339 GeolocationAPIEmbedderHasAccessMultipleBridgeIdAllow) { | |
1340 TestHelper("testMultipleBridgeIdAllow", | |
1341 "DoneGeolocationTest.PASSED", | |
1342 "DoneGeolocationTest.FAILED", | |
1343 "web_view/geolocation/embedder_has_permission"); | |
1344 } | |
1345 | |
1346 // Tests that | |
1347 // BrowserPluginGeolocationPermissionContext::CancelGeolocationPermissionRequest | |
1348 // is handled correctly (and does not crash). | |
1349 IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationAPICancelGeolocation) { | |
1350 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. | |
1351 ASSERT_TRUE(RunPlatformAppTest( | |
1352 "platform_apps/web_view/geolocation/cancel_request")) << message_; | |
1353 } | |
1354 | |
1355 IN_PROC_BROWSER_TEST_F(WebViewTest, GeolocationRequestGone) { | |
1356 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. | |
1357 ASSERT_TRUE(RunPlatformAppTest( | |
1358 "platform_apps/web_view/geolocation/geolocation_request_gone")) | |
1359 << message_; | |
1360 } | |
1361 | |
1362 IN_PROC_BROWSER_TEST_F(WebViewTest, ConsoleMessage) { | |
1363 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. | |
1364 ASSERT_TRUE(RunPlatformAppTestWithArg( | |
1365 "platform_apps/web_view/common", "console_messages")) | |
1366 << message_; | |
1367 } | |
1368 | |
1369 IN_PROC_BROWSER_TEST_F(WebViewTest, DownloadPermission) { | |
1370 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages. | |
1371 content::WebContents* guest_web_contents = | |
1372 LoadGuest("/extensions/platform_apps/web_view/download/guest.html", | |
1373 "web_view/download"); | |
1374 ASSERT_TRUE(guest_web_contents); | |
1375 | |
1376 // Replace WebContentsDelegate with mock version so we can intercept download | |
1377 // requests. | |
1378 content::WebContentsDelegate* delegate = guest_web_contents->GetDelegate(); | |
1379 MockDownloadWebContentsDelegate* mock_delegate = | |
1380 new MockDownloadWebContentsDelegate(delegate); | |
1381 guest_web_contents->SetDelegate(mock_delegate); | |
1382 | |
1383 // Start test. | |
1384 // 1. Guest requests a download that its embedder denies. | |
1385 EXPECT_TRUE(content::ExecuteScript(guest_web_contents, | |
1386 "startDownload('download-link-1')")); | |
1387 mock_delegate->WaitForCanDownload(false); // Expect to not allow. | |
1388 mock_delegate->Reset(); | |
1389 | |
1390 // 2. Guest requests a download that its embedder allows. | |
1391 EXPECT_TRUE(content::ExecuteScript(guest_web_contents, | |
1392 "startDownload('download-link-2')")); | |
1393 mock_delegate->WaitForCanDownload(true); // Expect to allow. | |
1394 mock_delegate->Reset(); | |
1395 | |
1396 // 3. Guest requests a download that its embedder ignores, this implies deny. | |
1397 EXPECT_TRUE(content::ExecuteScript(guest_web_contents, | |
1398 "startDownload('download-link-3')")); | |
1399 mock_delegate->WaitForCanDownload(false); // Expect to not allow. | |
1400 } | |
1401 | |
1402 // This test makes sure loading <webview> does not crash when there is an | |
1403 // extension which has content script whitelisted/forced. | |
1404 IN_PROC_BROWSER_TEST_F(WebViewTest, WhitelistedContentScript) { | |
1405 // Whitelist the extension for running content script we are going to load. | |
1406 extensions::Extension::ScriptingWhitelist whitelist; | |
1407 const std::string extension_id = "imeongpbjoodlnmlakaldhlcmijmhpbb"; | |
1408 whitelist.push_back(extension_id); | |
1409 extensions::Extension::SetScriptingWhitelist(whitelist); | |
1410 | |
1411 // Load the extension. | |
1412 const extensions::Extension* content_script_whitelisted_extension = | |
1413 LoadExtension(test_data_dir_.AppendASCII( | |
1414 "platform_apps/web_view/legacy/content_script")); | |
1415 ASSERT_TRUE(content_script_whitelisted_extension); | |
1416 ASSERT_EQ(extension_id, content_script_whitelisted_extension->id()); | |
1417 | |
1418 // Now load an app with <webview>. | |
1419 ExtensionTestMessageListener done_listener("DoneTest", false); | |
1420 LoadAndLaunchPlatformApp("web_view/content_script_whitelisted"); | |
1421 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); | |
1422 } | |
1423 | |
1424 IN_PROC_BROWSER_TEST_F(WebViewTest, SetPropertyOnDocumentReady) { | |
1425 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/document_ready")) | |
1426 << message_; | |
1427 } | |
1428 | |
1429 IN_PROC_BROWSER_TEST_F(WebViewTest, SetPropertyOnDocumentInteractive) { | |
1430 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/document_interactive")) | |
1431 << message_; | |
1432 } | |
1433 | |
1434 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestAlertDialog) { | |
1435 TestHelper("testAlertDialog", | |
1436 "DoneDialogTest.PASSED", | |
1437 "DoneDialogTest.FAILED", | |
1438 "web_view/dialog"); | |
1439 } | |
1440 | |
1441 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestConfirmDialog) { | |
1442 TestHelper("testConfirmDialog", | |
1443 "DoneDialogTest.PASSED", | |
1444 "DoneDialogTest.FAILED", | |
1445 "web_view/dialog"); | |
1446 } | |
1447 | |
1448 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestConfirmDialogCancel) { | |
1449 TestHelper("testConfirmDialogCancel", | |
1450 "DoneDialogTest.PASSED", | |
1451 "DoneDialogTest.FAILED", | |
1452 "web_view/dialog"); | |
1453 } | |
1454 | |
1455 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestConfirmDialogDefaultCancel) { | |
1456 TestHelper("testConfirmDialogDefaultCancel", | |
1457 "DoneDialogTest.PASSED", | |
1458 "DoneDialogTest.FAILED", | |
1459 "web_view/dialog"); | |
1460 } | |
1461 | |
1462 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestConfirmDialogDefaultGCCancel) { | |
1463 TestHelper("testConfirmDialogDefaultGCCancel", | |
1464 "DoneDialogTest.PASSED", | |
1465 "DoneDialogTest.FAILED", | |
1466 "web_view/dialog"); | |
1467 } | |
1468 | |
1469 IN_PROC_BROWSER_TEST_F(WebViewTest, Dialog_TestPromptDialog) { | |
1470 TestHelper("testPromptDialog", | |
1471 "DoneDialogTest.PASSED", | |
1472 "DoneDialogTest.FAILED", | |
1473 "web_view/dialog"); | |
1474 } | |
OLD | NEW |