1 // Copyright 2013 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.
5 #include "apps/ui/native_app_window.h"
6 #include "base/path_service.h"
7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/apps/app_browsertest_util.h"
10 #include "chrome/browser/chrome_content_browser_client.h"
11 #include "chrome/browser/extensions/extension_test_message_listener.h"
12 #include "chrome/browser/guest_view/guest_view_manager.h"
13 #include "chrome/browser/guest_view/guest_view_manager_factory.h"
14 #include "chrome/browser/prerender/prerender_link_manager.h"
15 #include "chrome/browser/prerender/prerender_link_manager_factory.h"
16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
18 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h"
19 #include "chrome/browser/task_manager/task_manager_browsertest_util.h"
20 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_dialogs.h"
22 #include "chrome/browser/ui/tabs/tab_strip_model.h"
23 #include "chrome/test/base/ui_test_utils.h"
24 #include "content/public/browser/gpu_data_manager.h"
25 #include "content/public/browser/interstitial_page.h"
26 #include "content/public/browser/interstitial_page_delegate.h"
27 #include "content/public/browser/notification_service.h"
28 #include "content/public/browser/render_process_host.h"
29 #include "content/public/browser/web_contents_delegate.h"
30 #include "content/public/common/content_switches.h"
31 #include "content/public/test/browser_test_utils.h"
32 #include "content/public/test/fake_speech_recognition_manager.h"
33 #include "content/public/test/test_renderer_host.h"
34 #include "extensions/common/extension.h"
35 #include "extensions/common/extensions_client.h"
36 #include "media/base/media_switches.h"
37 #include "net/test/embedded_test_server/embedded_test_server.h"
38 #include "net/test/embedded_test_server/http_request.h"
39 #include "net/test/embedded_test_server/http_response.h"
40 #include "ui/gl/gl_switches.h"
42 #if defined(OS_CHROMEOS)
43 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
44 #include "chrome/browser/chromeos/accessibility/speech_monitor.h"
47 // For fine-grained suppression on flaky tests.
49 #include "base/win/windows_version.h"
52 using extensions::ContextMenuMatcher
;
53 using extensions::MenuItem
;
54 using prerender::PrerenderLinkManager
;
55 using prerender::PrerenderLinkManagerFactory
;
56 using task_manager::browsertest_util::MatchAboutBlankTab
;
57 using task_manager::browsertest_util::MatchAnyApp
;
58 using task_manager::browsertest_util::MatchAnyBackground
;
59 using task_manager::browsertest_util::MatchAnyTab
;
60 using task_manager::browsertest_util::MatchAnyWebView
;
61 using task_manager::browsertest_util::MatchApp
;
62 using task_manager::browsertest_util::MatchBackground
;
63 using task_manager::browsertest_util::MatchWebView
;
64 using task_manager::browsertest_util::WaitForTaskManagerRows
;
68 const char kEmptyResponsePath
[] = "/close-socket";
69 const char kRedirectResponsePath
[] = "/server-redirect";
70 const char kRedirectResponseFullPath
[] =
71 "/extensions/platform_apps/web_view/shim/guest_redirect.html";
73 // Platform-specific filename relative to the chrome executable.
75 const wchar_t library_name
[] = L
"ppapi_tests.dll";
76 #elif defined(OS_MACOSX)
77 const char library_name
[] = "ppapi_tests.plugin";
78 #elif defined(OS_POSIX)
79 const char library_name
[] = "libppapi_tests.so";
82 class EmptyHttpResponse
: public net::test_server::HttpResponse
{
84 virtual std::string
ToResponseString() const OVERRIDE
{
89 class TestInterstitialPageDelegate
: public content::InterstitialPageDelegate
{
91 TestInterstitialPageDelegate() {
93 virtual ~TestInterstitialPageDelegate() {}
94 virtual std::string
GetHTMLContents() OVERRIDE
{ return std::string(); }
97 class TestGuestViewManager
: public GuestViewManager
{
99 explicit TestGuestViewManager(content::BrowserContext
* context
) :
100 GuestViewManager(context
),
101 web_contents_(NULL
) {}
103 content::WebContents
* WaitForGuestCreated() {
105 return web_contents_
;
107 message_loop_runner_
= new content::MessageLoopRunner
;
108 message_loop_runner_
->Run();
109 return web_contents_
;
113 // GuestViewManager override:
114 virtual void AddGuest(int guest_instance_id
,
115 content::WebContents
* guest_web_contents
) OVERRIDE
{
116 GuestViewManager::AddGuest(guest_instance_id
, guest_web_contents
);
117 web_contents_
= guest_web_contents
;
119 if (message_loop_runner_
)
120 message_loop_runner_
->Quit();
123 content::WebContents
* web_contents_
;
124 scoped_refptr
<content::MessageLoopRunner
> message_loop_runner_
;
127 // Test factory for creating test instances of GuestViewManager.
128 class TestGuestViewManagerFactory
: public GuestViewManagerFactory
{
130 TestGuestViewManagerFactory() :
131 test_guest_view_manager_(NULL
) {}
133 virtual ~TestGuestViewManagerFactory() {}
135 virtual GuestViewManager
* CreateGuestViewManager(
136 content::BrowserContext
* context
) OVERRIDE
{
137 return GetManager(context
);
140 TestGuestViewManager
* GetManager(content::BrowserContext
* context
) {
141 if (!test_guest_view_manager_
) {
142 test_guest_view_manager_
= new TestGuestViewManager(context
);
144 return test_guest_view_manager_
;
148 TestGuestViewManager
* test_guest_view_manager_
;
150 DISALLOW_COPY_AND_ASSIGN(TestGuestViewManagerFactory
);
153 class WebContentsHiddenObserver
: public content::WebContentsObserver
{
155 WebContentsHiddenObserver(content::WebContents
* web_contents
,
156 const base::Closure
& hidden_callback
)
157 : WebContentsObserver(web_contents
),
158 hidden_callback_(hidden_callback
),
159 hidden_observed_(false) {
162 // WebContentsObserver.
163 virtual void WasHidden() OVERRIDE
{
164 hidden_observed_
= true;
165 hidden_callback_
.Run();
168 bool hidden_observed() { return hidden_observed_
; }
171 base::Closure hidden_callback_
;
172 bool hidden_observed_
;
174 DISALLOW_COPY_AND_ASSIGN(WebContentsHiddenObserver
);
177 class InterstitialObserver
: public content::WebContentsObserver
{
179 InterstitialObserver(content::WebContents
* web_contents
,
180 const base::Closure
& attach_callback
,
181 const base::Closure
& detach_callback
)
182 : WebContentsObserver(web_contents
),
183 attach_callback_(attach_callback
),
184 detach_callback_(detach_callback
) {
187 virtual void DidAttachInterstitialPage() OVERRIDE
{
188 attach_callback_
.Run();
191 virtual void DidDetachInterstitialPage() OVERRIDE
{
192 detach_callback_
.Run();
196 base::Closure attach_callback_
;
197 base::Closure detach_callback_
;
199 DISALLOW_COPY_AND_ASSIGN(InterstitialObserver
);
202 void ExecuteScriptWaitForTitle(content::WebContents
* web_contents
,
205 base::string16
expected_title(base::ASCIIToUTF16(title
));
206 base::string16
error_title(base::ASCIIToUTF16("error"));
208 content::TitleWatcher
title_watcher(web_contents
, expected_title
);
209 title_watcher
.AlsoWaitForTitle(error_title
);
210 EXPECT_TRUE(content::ExecuteScript(web_contents
, script
));
211 EXPECT_EQ(expected_title
, title_watcher
.WaitAndGetTitle());
216 // This class intercepts media access request from the embedder. The request
217 // should be triggered only if the embedder API (from tests) allows the request
219 // We do not issue the actual media request; the fact that the request reached
220 // embedder's WebContents is good enough for our tests. This is also to make
221 // the test run successfully on trybots.
222 class MockWebContentsDelegate
: public content::WebContentsDelegate
{
224 MockWebContentsDelegate() : requested_(false) {}
225 virtual ~MockWebContentsDelegate() {}
227 virtual void RequestMediaAccessPermission(
228 content::WebContents
* web_contents
,
229 const content::MediaStreamRequest
& request
,
230 const content::MediaResponseCallback
& callback
) OVERRIDE
{
232 if (message_loop_runner_
.get())
233 message_loop_runner_
->Quit();
236 void WaitForSetMediaPermission() {
239 message_loop_runner_
= new content::MessageLoopRunner
;
240 message_loop_runner_
->Run();
245 scoped_refptr
<content::MessageLoopRunner
> message_loop_runner_
;
247 DISALLOW_COPY_AND_ASSIGN(MockWebContentsDelegate
);
250 // This class intercepts download request from the guest.
251 class MockDownloadWebContentsDelegate
: public content::WebContentsDelegate
{
253 explicit MockDownloadWebContentsDelegate(
254 content::WebContentsDelegate
* orig_delegate
)
255 : orig_delegate_(orig_delegate
),
256 waiting_for_decision_(false),
257 expect_allow_(false),
258 decision_made_(false),
259 last_download_allowed_(false) {}
260 virtual ~MockDownloadWebContentsDelegate() {}
262 virtual void CanDownload(
263 content::RenderViewHost
* render_view_host
,
265 const std::string
& request_method
,
266 const base::Callback
<void(bool)>& callback
) OVERRIDE
{
267 orig_delegate_
->CanDownload(
268 render_view_host
, url
, request_method
,
269 base::Bind(&MockDownloadWebContentsDelegate::DownloadDecided
,
270 base::Unretained(this)));
273 void WaitForCanDownload(bool expect_allow
) {
274 EXPECT_FALSE(waiting_for_decision_
);
275 waiting_for_decision_
= true;
277 if (decision_made_
) {
278 EXPECT_EQ(expect_allow
, last_download_allowed_
);
282 expect_allow_
= expect_allow
;
283 message_loop_runner_
= new content::MessageLoopRunner
;
284 message_loop_runner_
->Run();
287 void DownloadDecided(bool allow
) {
288 EXPECT_FALSE(decision_made_
);
289 decision_made_
= true;
291 if (waiting_for_decision_
) {
292 EXPECT_EQ(expect_allow_
, allow
);
293 if (message_loop_runner_
.get())
294 message_loop_runner_
->Quit();
297 last_download_allowed_
= allow
;
301 waiting_for_decision_
= false;
302 decision_made_
= false;
306 content::WebContentsDelegate
* orig_delegate_
;
307 bool waiting_for_decision_
;
310 bool last_download_allowed_
;
311 scoped_refptr
<content::MessageLoopRunner
> message_loop_runner_
;
313 DISALLOW_COPY_AND_ASSIGN(MockDownloadWebContentsDelegate
);
316 class WebViewTest
: public extensions::PlatformAppBrowserTest
{
318 virtual void SetUp() OVERRIDE
{
319 if (UsesFakeSpeech()) {
320 // SpeechRecognition test specific SetUp.
321 fake_speech_recognition_manager_
.reset(
322 new content::FakeSpeechRecognitionManager());
323 fake_speech_recognition_manager_
->set_should_send_fake_response(true);
324 // Inject the fake manager factory so that the test result is returned to
326 content::SpeechRecognitionManager::SetManagerForTesting(
327 fake_speech_recognition_manager_
.get());
329 extensions::PlatformAppBrowserTest::SetUp();
332 virtual void TearDown() OVERRIDE
{
333 if (UsesFakeSpeech()) {
334 // SpeechRecognition test specific TearDown.
335 content::SpeechRecognitionManager::SetManagerForTesting(NULL
);
338 extensions::PlatformAppBrowserTest::TearDown();
341 virtual void SetUpOnMainThread() OVERRIDE
{
342 extensions::PlatformAppBrowserTest::SetUpOnMainThread();
343 const testing::TestInfo
* const test_info
=
344 testing::UnitTest::GetInstance()->current_test_info();
345 // Mock out geolocation for geolocation specific tests.
346 if (!strncmp(test_info
->name(), "GeolocationAPI",
347 strlen("GeolocationAPI"))) {
348 ui_test_utils::OverrideGeolocation(10, 20);
352 virtual void SetUpCommandLine(CommandLine
* command_line
) OVERRIDE
{
353 command_line
->AppendSwitch(switches::kUseFakeDeviceForMediaStream
);
354 command_line
->AppendSwitchASCII(switches::kJavaScriptFlags
, "--expose-gc");
356 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line
);
359 // This method is responsible for initializing a packaged app, which contains
360 // multiple webview tags. The tags have different partition identifiers and
361 // their WebContent objects are returned as output. The method also verifies
362 // the expected process allocation and storage partition assignment.
363 // The |navigate_to_url| parameter is used to navigate the main browser
366 // TODO(ajwong): This function is getting to be too large. Either refactor it
367 // so the test can specify a configuration of WebView tags that we will
368 // dynamically inject JS to generate, or move this test wholesale into
369 // something that RunPlatformAppTest() can execute purely in Javascript. This
370 // won't let us do a white-box examination of the StoragePartition equivalence
371 // directly, but we will be able to view the black box effects which is good
372 // enough. http://crbug.com/160361
373 void NavigateAndOpenAppForIsolation(
374 GURL navigate_to_url
,
375 content::WebContents
** default_tag_contents1
,
376 content::WebContents
** default_tag_contents2
,
377 content::WebContents
** named_partition_contents1
,
378 content::WebContents
** named_partition_contents2
,
379 content::WebContents
** persistent_partition_contents1
,
380 content::WebContents
** persistent_partition_contents2
,
381 content::WebContents
** persistent_partition_contents3
) {
382 GURL::Replacements replace_host
;
383 std::string
host_str("localhost"); // Must stay in scope with replace_host.
384 replace_host
.SetHostStr(host_str
);
386 navigate_to_url
= navigate_to_url
.ReplaceComponents(replace_host
);
388 GURL tag_url1
= embedded_test_server()->GetURL(
389 "/extensions/platform_apps/web_view/isolation/cookie.html");
390 tag_url1
= tag_url1
.ReplaceComponents(replace_host
);
391 GURL tag_url2
= embedded_test_server()->GetURL(
392 "/extensions/platform_apps/web_view/isolation/cookie2.html");
393 tag_url2
= tag_url2
.ReplaceComponents(replace_host
);
394 GURL tag_url3
= embedded_test_server()->GetURL(
395 "/extensions/platform_apps/web_view/isolation/storage1.html");
396 tag_url3
= tag_url3
.ReplaceComponents(replace_host
);
397 GURL tag_url4
= embedded_test_server()->GetURL(
398 "/extensions/platform_apps/web_view/isolation/storage2.html");
399 tag_url4
= tag_url4
.ReplaceComponents(replace_host
);
400 GURL tag_url5
= embedded_test_server()->GetURL(
401 "/extensions/platform_apps/web_view/isolation/storage1.html#p1");
402 tag_url5
= tag_url5
.ReplaceComponents(replace_host
);
403 GURL tag_url6
= embedded_test_server()->GetURL(
404 "/extensions/platform_apps/web_view/isolation/storage1.html#p2");
405 tag_url6
= tag_url6
.ReplaceComponents(replace_host
);
406 GURL tag_url7
= embedded_test_server()->GetURL(
407 "/extensions/platform_apps/web_view/isolation/storage1.html#p3");
408 tag_url7
= tag_url7
.ReplaceComponents(replace_host
);
410 ui_test_utils::NavigateToURLWithDisposition(
411 browser(), navigate_to_url
, CURRENT_TAB
,
412 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION
);
414 ui_test_utils::UrlLoadObserver
observer1(
415 tag_url1
, content::NotificationService::AllSources());
416 ui_test_utils::UrlLoadObserver
observer2(
417 tag_url2
, content::NotificationService::AllSources());
418 ui_test_utils::UrlLoadObserver
observer3(
419 tag_url3
, content::NotificationService::AllSources());
420 ui_test_utils::UrlLoadObserver
observer4(
421 tag_url4
, content::NotificationService::AllSources());
422 ui_test_utils::UrlLoadObserver
observer5(
423 tag_url5
, content::NotificationService::AllSources());
424 ui_test_utils::UrlLoadObserver
observer6(
425 tag_url6
, content::NotificationService::AllSources());
426 ui_test_utils::UrlLoadObserver
observer7(
427 tag_url7
, content::NotificationService::AllSources());
428 LoadAndLaunchPlatformApp("web_view/isolation", "Launched");
437 content::Source
<content::NavigationController
> source1
= observer1
.source();
438 EXPECT_TRUE(source1
->GetWebContents()->GetRenderProcessHost()->
440 content::Source
<content::NavigationController
> source2
= observer2
.source();
441 EXPECT_TRUE(source2
->GetWebContents()->GetRenderProcessHost()->
443 content::Source
<content::NavigationController
> source3
= observer3
.source();
444 EXPECT_TRUE(source3
->GetWebContents()->GetRenderProcessHost()->
446 content::Source
<content::NavigationController
> source4
= observer4
.source();
447 EXPECT_TRUE(source4
->GetWebContents()->GetRenderProcessHost()->
449 content::Source
<content::NavigationController
> source5
= observer5
.source();
450 EXPECT_TRUE(source5
->GetWebContents()->GetRenderProcessHost()->
452 content::Source
<content::NavigationController
> source6
= observer6
.source();
453 EXPECT_TRUE(source6
->GetWebContents()->GetRenderProcessHost()->
455 content::Source
<content::NavigationController
> source7
= observer7
.source();
456 EXPECT_TRUE(source7
->GetWebContents()->GetRenderProcessHost()->
459 // Check that the first two tags use the same process and it is different
460 // than the process used by the other two.
461 EXPECT_EQ(source1
->GetWebContents()->GetRenderProcessHost()->GetID(),
462 source2
->GetWebContents()->GetRenderProcessHost()->GetID());
463 EXPECT_EQ(source3
->GetWebContents()->GetRenderProcessHost()->GetID(),
464 source4
->GetWebContents()->GetRenderProcessHost()->GetID());
465 EXPECT_NE(source1
->GetWebContents()->GetRenderProcessHost()->GetID(),
466 source3
->GetWebContents()->GetRenderProcessHost()->GetID());
468 // The two sets of tags should also be isolated from the main browser.
469 EXPECT_NE(source1
->GetWebContents()->GetRenderProcessHost()->GetID(),
470 browser()->tab_strip_model()->GetWebContentsAt(0)->
471 GetRenderProcessHost()->GetID());
472 EXPECT_NE(source3
->GetWebContents()->GetRenderProcessHost()->GetID(),
473 browser()->tab_strip_model()->GetWebContentsAt(0)->
474 GetRenderProcessHost()->GetID());
476 // Check that the storage partitions of the first two tags match and are
477 // different than the other two.
479 source1
->GetWebContents()->GetRenderProcessHost()->
480 GetStoragePartition(),
481 source2
->GetWebContents()->GetRenderProcessHost()->
482 GetStoragePartition());
484 source3
->GetWebContents()->GetRenderProcessHost()->
485 GetStoragePartition(),
486 source4
->GetWebContents()->GetRenderProcessHost()->
487 GetStoragePartition());
489 source1
->GetWebContents()->GetRenderProcessHost()->
490 GetStoragePartition(),
491 source3
->GetWebContents()->GetRenderProcessHost()->
492 GetStoragePartition());
494 // Ensure the persistent storage partitions are different.
496 source5
->GetWebContents()->GetRenderProcessHost()->
497 GetStoragePartition(),
498 source6
->GetWebContents()->GetRenderProcessHost()->
499 GetStoragePartition());
501 source5
->GetWebContents()->GetRenderProcessHost()->
502 GetStoragePartition(),
503 source7
->GetWebContents()->GetRenderProcessHost()->
504 GetStoragePartition());
506 source1
->GetWebContents()->GetRenderProcessHost()->
507 GetStoragePartition(),
508 source5
->GetWebContents()->GetRenderProcessHost()->
509 GetStoragePartition());
511 source1
->GetWebContents()->GetRenderProcessHost()->
512 GetStoragePartition(),
513 source7
->GetWebContents()->GetRenderProcessHost()->
514 GetStoragePartition());
516 *default_tag_contents1
= source1
->GetWebContents();
517 *default_tag_contents2
= source2
->GetWebContents();
518 *named_partition_contents1
= source3
->GetWebContents();
519 *named_partition_contents2
= source4
->GetWebContents();
520 if (persistent_partition_contents1
) {
521 *persistent_partition_contents1
= source5
->GetWebContents();
523 if (persistent_partition_contents2
) {
524 *persistent_partition_contents2
= source6
->GetWebContents();
526 if (persistent_partition_contents3
) {
527 *persistent_partition_contents3
= source7
->GetWebContents();
531 // Handles |request| by serving a redirect response.
532 static scoped_ptr
<net::test_server::HttpResponse
> RedirectResponseHandler(
533 const std::string
& path
,
534 const GURL
& redirect_target
,
535 const net::test_server::HttpRequest
& request
) {
536 if (!StartsWithASCII(path
, request
.relative_url
, true))
537 return scoped_ptr
<net::test_server::HttpResponse
>();
539 scoped_ptr
<net::test_server::BasicHttpResponse
> http_response(
540 new net::test_server::BasicHttpResponse
);
541 http_response
->set_code(net::HTTP_MOVED_PERMANENTLY
);
542 http_response
->AddCustomHeader("Location", redirect_target
.spec());
543 return http_response
.PassAs
<net::test_server::HttpResponse
>();
546 // Handles |request| by serving an empty response.
547 static scoped_ptr
<net::test_server::HttpResponse
> EmptyResponseHandler(
548 const std::string
& path
,
549 const net::test_server::HttpRequest
& request
) {
550 if (StartsWithASCII(path
, request
.relative_url
, true)) {
551 return scoped_ptr
<net::test_server::HttpResponse
>(
552 new EmptyHttpResponse
);
555 return scoped_ptr
<net::test_server::HttpResponse
>();
558 // Shortcut to return the current MenuManager.
559 extensions::MenuManager
* menu_manager() {
560 return extensions::MenuManager::Get(browser()->profile());
563 // This gets all the items that any extension has registered for possible
564 // inclusion in context menus.
565 MenuItem::List
GetItems() {
566 MenuItem::List result
;
567 std::set
<MenuItem::ExtensionKey
> extension_ids
=
568 menu_manager()->ExtensionIds();
569 std::set
<MenuItem::ExtensionKey
>::iterator i
;
570 for (i
= extension_ids
.begin(); i
!= extension_ids
.end(); ++i
) {
571 const MenuItem::List
* list
= menu_manager()->MenuItems(*i
);
572 result
.insert(result
.end(), list
->begin(), list
->end());
582 void TestHelper(const std::string
& test_name
,
583 const std::string
& app_location
,
584 TestServer test_server
) {
585 // For serving guest pages.
586 if (test_server
== NEEDS_TEST_SERVER
) {
587 if (!StartEmbeddedTestServer()) {
588 LOG(ERROR
) << "FAILED TO START TEST SERVER.";
591 embedded_test_server()->RegisterRequestHandler(
592 base::Bind(&WebViewTest::RedirectResponseHandler
,
593 kRedirectResponsePath
,
594 embedded_test_server()->GetURL(kRedirectResponseFullPath
)));
596 embedded_test_server()->RegisterRequestHandler(
597 base::Bind(&WebViewTest::EmptyResponseHandler
, kEmptyResponsePath
));
600 LoadAndLaunchPlatformApp(app_location
.c_str(), "Launched");
602 // Flush any pending events to make sure we start with a clean slate.
603 content::RunAllPendingInMessageLoop();
605 content::WebContents
* embedder_web_contents
=
606 GetFirstAppWindowWebContents();
607 if (!embedder_web_contents
) {
608 LOG(ERROR
) << "UNABLE TO FIND EMBEDDER WEB CONTENTS.";
612 ExtensionTestMessageListener
done_listener("TEST_PASSED", false);
613 done_listener
.set_failure_message("TEST_FAILED");
614 if (!content::ExecuteScript(
615 embedder_web_contents
,
616 base::StringPrintf("runTest('%s')", test_name
.c_str()))) {
617 LOG(ERROR
) << "UNABLE TO START TEST.";
620 ASSERT_TRUE(done_listener
.WaitUntilSatisfied());
623 content::WebContents
* LoadGuest(const std::string
& guest_path
,
624 const std::string
& app_path
) {
625 GURL::Replacements replace_host
;
626 std::string
host_str("localhost"); // Must stay in scope with replace_host.
627 replace_host
.SetHostStr(host_str
);
629 GURL guest_url
= embedded_test_server()->GetURL(guest_path
);
630 guest_url
= guest_url
.ReplaceComponents(replace_host
);
632 ui_test_utils::UrlLoadObserver
guest_observer(
633 guest_url
, content::NotificationService::AllSources());
635 LoadAndLaunchPlatformApp(app_path
.c_str(), "guest-loaded");
637 guest_observer
.Wait();
638 content::Source
<content::NavigationController
> source
=
639 guest_observer
.source();
640 EXPECT_TRUE(source
->GetWebContents()->GetRenderProcessHost()->
643 content::WebContents
* guest_web_contents
= source
->GetWebContents();
644 return guest_web_contents
;
647 // Runs media_access/allow tests.
648 void MediaAccessAPIAllowTestHelper(const std::string
& test_name
);
650 // Runs media_access/deny tests, each of them are run separately otherwise
651 // they timeout (mostly on Windows).
652 void MediaAccessAPIDenyTestHelper(const std::string
& test_name
) {
653 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
654 LoadAndLaunchPlatformApp("web_view/media_access/deny", "loaded");
656 content::WebContents
* embedder_web_contents
=
657 GetFirstAppWindowWebContents();
658 ASSERT_TRUE(embedder_web_contents
);
660 ExtensionTestMessageListener
test_run_listener("PASSED", false);
661 test_run_listener
.set_failure_message("FAILED");
663 content::ExecuteScript(
664 embedder_web_contents
,
665 base::StringPrintf("startDenyTest('%s')", test_name
.c_str())));
666 ASSERT_TRUE(test_run_listener
.WaitUntilSatisfied());
669 void WaitForInterstitial(content::WebContents
* web_contents
) {
670 scoped_refptr
<content::MessageLoopRunner
> loop_runner(
671 new content::MessageLoopRunner
);
672 InterstitialObserver
observer(web_contents
,
673 loop_runner
->QuitClosure(),
675 if (!content::InterstitialPage::GetInterstitialPage(web_contents
))
679 void LoadAppWithGuest(const std::string
& app_path
) {
681 ExtensionTestMessageListener
launched_listener("WebViewTest.LAUNCHED",
683 launched_listener
.set_failure_message("WebViewTest.FAILURE");
684 LoadAndLaunchPlatformApp(app_path
.c_str(), &launched_listener
);
686 guest_web_contents_
= GetGuestViewManager()->WaitForGuestCreated();
689 void SendMessageToEmbedder(const std::string
& message
) {
691 content::ExecuteScript(
692 GetEmbedderWebContents(),
693 base::StringPrintf("onAppCommand('%s');", message
.c_str())));
696 void SendMessageToGuestAndWait(const std::string
& message
,
697 const std::string
& wait_message
) {
698 scoped_ptr
<ExtensionTestMessageListener
> listener
;
699 if (!wait_message
.empty()) {
700 listener
.reset(new ExtensionTestMessageListener(wait_message
, false));
704 content::ExecuteScript(
705 GetGuestWebContents(),
706 base::StringPrintf("onAppCommand('%s');", message
.c_str())));
709 ASSERT_TRUE(listener
->WaitUntilSatisfied());
713 content::WebContents
* GetGuestWebContents() {
714 return guest_web_contents_
;
717 content::WebContents
* GetEmbedderWebContents() {
718 if (!embedder_web_contents_
) {
719 embedder_web_contents_
= GetFirstAppWindowWebContents();
721 return embedder_web_contents_
;
724 TestGuestViewManager
* GetGuestViewManager() {
725 return factory_
.GetManager(browser()->profile());
728 WebViewTest() : guest_web_contents_(NULL
),
729 embedder_web_contents_(NULL
) {
730 GuestViewManager::set_factory_for_testing(&factory_
);
734 bool UsesFakeSpeech() {
735 const testing::TestInfo
* const test_info
=
736 testing::UnitTest::GetInstance()->current_test_info();
738 // SpeechRecognition test specific SetUp.
739 return !strcmp(test_info
->name(),
740 "SpeechRecognitionAPI_HasPermissionAllow");
743 scoped_ptr
<content::FakeSpeechRecognitionManager
>
744 fake_speech_recognition_manager_
;
746 TestGuestViewManagerFactory factory_
;
747 // Note that these are only set if you launch app using LoadAppWithGuest().
748 content::WebContents
* guest_web_contents_
;
749 content::WebContents
* embedder_web_contents_
;
752 // This test verifies that hiding the guest triggers WebContents::WasHidden().
753 IN_PROC_BROWSER_TEST_F(WebViewTest
, GuestVisibilityChanged
) {
754 LoadAppWithGuest("web_view/visibility_changed");
756 scoped_refptr
<content::MessageLoopRunner
> loop_runner(
757 new content::MessageLoopRunner
);
758 WebContentsHiddenObserver
observer(GetGuestWebContents(),
759 loop_runner
->QuitClosure());
761 // Handled in platform_apps/web_view/visibility_changed/main.js
762 SendMessageToEmbedder("hide-guest");
763 if (!observer
.hidden_observed())
767 // This test verifies that hiding the embedder also hides the guest.
768 IN_PROC_BROWSER_TEST_F(WebViewTest
, EmbedderVisibilityChanged
) {
769 LoadAppWithGuest("web_view/visibility_changed");
771 scoped_refptr
<content::MessageLoopRunner
> loop_runner(
772 new content::MessageLoopRunner
);
773 WebContentsHiddenObserver
observer(GetGuestWebContents(),
774 loop_runner
->QuitClosure());
776 // Handled in platform_apps/web_view/visibility_changed/main.js
777 SendMessageToEmbedder("hide-embedder");
778 if (!observer
.hidden_observed())
782 // This test verifies that reloading the embedder reloads the guest (and doest
784 IN_PROC_BROWSER_TEST_F(WebViewTest
, ReloadEmbedder
) {
785 // Just load a guest from other test, we do not want to add a separate
786 // platform_app for this test.
787 LoadAppWithGuest("web_view/visibility_changed");
789 ExtensionTestMessageListener
launched_again_listener("WebViewTest.LAUNCHED",
791 GetEmbedderWebContents()->GetController().Reload(false);
792 ASSERT_TRUE(launched_again_listener
.WaitUntilSatisfied());
795 IN_PROC_BROWSER_TEST_F(WebViewTest
, AcceptTouchEvents
) {
796 LoadAppWithGuest("web_view/accept_touch_events");
798 content::RenderViewHost
* embedder_rvh
=
799 GetEmbedderWebContents()->GetRenderViewHost();
801 bool embedder_has_touch_handler
=
802 content::RenderViewHostTester::HasTouchEventHandler(embedder_rvh
);
803 EXPECT_FALSE(embedder_has_touch_handler
);
805 SendMessageToGuestAndWait("install-touch-handler", "installed-touch-handler");
807 // Note that we need to wait for the installed/registered touch handler to
808 // appear in browser process before querying |embedder_rvh|.
809 // In practice, since we do a roundrtip from browser process to guest and
810 // back, this is sufficient.
811 embedder_has_touch_handler
=
812 content::RenderViewHostTester::HasTouchEventHandler(embedder_rvh
);
813 EXPECT_TRUE(embedder_has_touch_handler
);
815 SendMessageToGuestAndWait("uninstall-touch-handler",
816 "uninstalled-touch-handler");
817 // Same as the note above about waiting.
818 embedder_has_touch_handler
=
819 content::RenderViewHostTester::HasTouchEventHandler(embedder_rvh
);
820 EXPECT_FALSE(embedder_has_touch_handler
);
823 // This test ensures JavaScript errors ("Cannot redefine property") do not
824 // happen when a <webview> is removed from DOM and added back.
825 IN_PROC_BROWSER_TEST_F(WebViewTest
,
826 AddRemoveWebView_AddRemoveWebView
) {
827 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
828 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/addremove"))
832 IN_PROC_BROWSER_TEST_F(WebViewTest
, AutoSize
) {
834 // Flaky on XP bot http://crbug.com/299507
835 if (base::win::GetVersion() <= base::win::VERSION_XP
)
839 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/autosize"))
843 // http://crbug.com/326332
844 IN_PROC_BROWSER_TEST_F(WebViewTest
, DISABLED_Shim_TestAutosizeAfterNavigation
) {
845 TestHelper("testAutosizeAfterNavigation", "web_view/shim", NO_TEST_SERVER
);
848 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestAutosizeBeforeNavigation
) {
849 TestHelper("testAutosizeBeforeNavigation", "web_view/shim", NO_TEST_SERVER
);
851 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestAutosizeRemoveAttributes
) {
852 TestHelper("testAutosizeRemoveAttributes", "web_view/shim", NO_TEST_SERVER
);
855 // This test is disabled due to being flaky. http://crbug.com/282116
857 #define MAYBE_Shim_TestAutosizeWithPartialAttributes \
858 DISABLED_Shim_TestAutosizeWithPartialAttributes
860 #define MAYBE_Shim_TestAutosizeWithPartialAttributes \
861 Shim_TestAutosizeWithPartialAttributes
863 IN_PROC_BROWSER_TEST_F(WebViewTest
,
864 MAYBE_Shim_TestAutosizeWithPartialAttributes
) {
865 TestHelper("testAutosizeWithPartialAttributes",
870 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestAPIMethodExistence
) {
871 TestHelper("testAPIMethodExistence", "web_view/shim", NO_TEST_SERVER
);
874 // Tests the existence of WebRequest API event objects on the request
875 // object, on the webview element, and hanging directly off webview.
876 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestWebRequestAPIExistence
) {
877 TestHelper("testWebRequestAPIExistence", "web_view/shim", NO_TEST_SERVER
);
880 // http://crbug.com/315920
881 #if defined(GOOGLE_CHROME_BUILD) && (defined(OS_WIN) || defined(OS_LINUX))
882 #define MAYBE_Shim_TestChromeExtensionURL DISABLED_Shim_TestChromeExtensionURL
884 #define MAYBE_Shim_TestChromeExtensionURL Shim_TestChromeExtensionURL
886 IN_PROC_BROWSER_TEST_F(WebViewTest
, MAYBE_Shim_TestChromeExtensionURL
) {
887 TestHelper("testChromeExtensionURL", "web_view/shim", NO_TEST_SERVER
);
890 // http://crbug.com/315920
891 #if defined(GOOGLE_CHROME_BUILD) && (defined(OS_WIN) || defined(OS_LINUX))
892 #define MAYBE_Shim_TestChromeExtensionRelativePath \
893 DISABLED_Shim_TestChromeExtensionRelativePath
895 #define MAYBE_Shim_TestChromeExtensionRelativePath \
896 Shim_TestChromeExtensionRelativePath
898 IN_PROC_BROWSER_TEST_F(WebViewTest
,
899 MAYBE_Shim_TestChromeExtensionRelativePath
) {
900 TestHelper("testChromeExtensionRelativePath",
905 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestDisplayNoneWebviewLoad
) {
906 TestHelper("testDisplayNoneWebviewLoad", "web_view/shim", NO_TEST_SERVER
);
909 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestDisplayNoneWebviewRemoveChild
) {
910 TestHelper("testDisplayNoneWebviewRemoveChild",
911 "web_view/shim", NO_TEST_SERVER
);
914 IN_PROC_BROWSER_TEST_F(WebViewTest
,
915 Shim_TestInlineScriptFromAccessibleResources
) {
916 TestHelper("testInlineScriptFromAccessibleResources",
921 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestInvalidChromeExtensionURL
) {
922 TestHelper("testInvalidChromeExtensionURL", "web_view/shim", NO_TEST_SERVER
);
925 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestEventName
) {
926 TestHelper("testEventName", "web_view/shim", NO_TEST_SERVER
);
929 // WebViewTest.Shim_TestOnEventProperty is flaky, so disable it.
930 // http://crbug.com/359832.
931 IN_PROC_BROWSER_TEST_F(WebViewTest
, DISABLED_Shim_TestOnEventProperty
) {
932 TestHelper("testOnEventProperties", "web_view/shim", NO_TEST_SERVER
);
935 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestLoadProgressEvent
) {
936 TestHelper("testLoadProgressEvent", "web_view/shim", NO_TEST_SERVER
);
939 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestDestroyOnEventListener
) {
940 TestHelper("testDestroyOnEventListener", "web_view/shim", NO_TEST_SERVER
);
943 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestCannotMutateEventName
) {
944 TestHelper("testCannotMutateEventName", "web_view/shim", NO_TEST_SERVER
);
947 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestPartitionRaisesException
) {
948 TestHelper("testPartitionRaisesException", "web_view/shim", NO_TEST_SERVER
);
951 IN_PROC_BROWSER_TEST_F(WebViewTest
,
952 Shim_TestPartitionRemovalAfterNavigationFails
) {
953 TestHelper("testPartitionRemovalAfterNavigationFails",
958 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestExecuteScriptFail
) {
960 // Flaky on XP bot http://crbug.com/266185
961 if (base::win::GetVersion() <= base::win::VERSION_XP
)
965 TestHelper("testExecuteScriptFail", "web_view/shim", NEEDS_TEST_SERVER
);
968 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestExecuteScript
) {
969 TestHelper("testExecuteScript", "web_view/shim", NO_TEST_SERVER
);
972 IN_PROC_BROWSER_TEST_F(
974 Shim_TestExecuteScriptIsAbortedWhenWebViewSourceIsChanged
) {
975 TestHelper("testExecuteScriptIsAbortedWhenWebViewSourceIsChanged",
980 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestTerminateAfterExit
) {
981 TestHelper("testTerminateAfterExit", "web_view/shim", NO_TEST_SERVER
);
984 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestAssignSrcAfterCrash
) {
985 TestHelper("testAssignSrcAfterCrash", "web_view/shim", NO_TEST_SERVER
);
988 IN_PROC_BROWSER_TEST_F(WebViewTest
,
989 Shim_TestNavOnConsecutiveSrcAttributeChanges
) {
990 TestHelper("testNavOnConsecutiveSrcAttributeChanges",
995 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestNavOnSrcAttributeChange
) {
996 TestHelper("testNavOnSrcAttributeChange", "web_view/shim", NO_TEST_SERVER
);
999 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestNavigateAfterResize
) {
1000 TestHelper("testNavigateAfterResize", "web_view/shim", NO_TEST_SERVER
);
1003 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestRemoveSrcAttribute
) {
1004 TestHelper("testRemoveSrcAttribute", "web_view/shim", NO_TEST_SERVER
);
1007 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestReassignSrcAttribute
) {
1008 TestHelper("testReassignSrcAttribute", "web_view/shim", NO_TEST_SERVER
);
1011 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestNewWindow
) {
1012 TestHelper("testNewWindow", "web_view/shim", NEEDS_TEST_SERVER
);
1015 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestNewWindowTwoListeners
) {
1016 TestHelper("testNewWindowTwoListeners", "web_view/shim", NEEDS_TEST_SERVER
);
1019 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestNewWindowNoPreventDefault
) {
1020 TestHelper("testNewWindowNoPreventDefault",
1025 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestNewWindowNoReferrerLink
) {
1026 TestHelper("testNewWindowNoReferrerLink", "web_view/shim", NEEDS_TEST_SERVER
);
1029 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestContentLoadEvent
) {
1030 TestHelper("testContentLoadEvent", "web_view/shim", NO_TEST_SERVER
);
1033 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestDeclarativeWebRequestAPI
) {
1034 TestHelper("testDeclarativeWebRequestAPI",
1039 IN_PROC_BROWSER_TEST_F(WebViewTest
,
1040 Shim_TestDeclarativeWebRequestAPISendMessage
) {
1041 TestHelper("testDeclarativeWebRequestAPISendMessage",
1046 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestWebRequestAPI
) {
1047 TestHelper("testWebRequestAPI", "web_view/shim", NEEDS_TEST_SERVER
);
1050 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestWebRequestAPIGoogleProperty
) {
1051 TestHelper("testWebRequestAPIGoogleProperty",
1056 // This test is disabled due to being flaky. http://crbug.com/309451
1058 #define MAYBE_Shim_TestWebRequestListenerSurvivesReparenting \
1059 DISABLED_Shim_TestWebRequestListenerSurvivesReparenting
1061 #define MAYBE_Shim_TestWebRequestListenerSurvivesReparenting \
1062 Shim_TestWebRequestListenerSurvivesReparenting
1064 IN_PROC_BROWSER_TEST_F(
1066 MAYBE_Shim_TestWebRequestListenerSurvivesReparenting
) {
1067 TestHelper("testWebRequestListenerSurvivesReparenting",
1072 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestLoadStartLoadRedirect
) {
1073 TestHelper("testLoadStartLoadRedirect", "web_view/shim", NEEDS_TEST_SERVER
);
1076 IN_PROC_BROWSER_TEST_F(WebViewTest
,
1077 Shim_TestLoadAbortChromeExtensionURLWrongPartition
) {
1078 TestHelper("testLoadAbortChromeExtensionURLWrongPartition",
1083 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestLoadAbortEmptyResponse
) {
1084 TestHelper("testLoadAbortEmptyResponse", "web_view/shim", NEEDS_TEST_SERVER
);
1087 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestLoadAbortIllegalChromeURL
) {
1088 TestHelper("testLoadAbortIllegalChromeURL",
1093 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestLoadAbortIllegalFileURL
) {
1094 TestHelper("testLoadAbortIllegalFileURL", "web_view/shim", NO_TEST_SERVER
);
1097 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestLoadAbortIllegalJavaScriptURL
) {
1098 TestHelper("testLoadAbortIllegalJavaScriptURL",
1103 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestLoadAbortInvalidNavigation
) {
1104 TestHelper("testLoadAbortInvalidNavigation", "web_view/shim", NO_TEST_SERVER
);
1107 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestLoadAbortNonWebSafeScheme
) {
1108 TestHelper("testLoadAbortNonWebSafeScheme", "web_view/shim", NO_TEST_SERVER
);
1111 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestReload
) {
1112 TestHelper("testReload", "web_view/shim", NEEDS_TEST_SERVER
);
1115 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestGetProcessId
) {
1116 TestHelper("testGetProcessId", "web_view/shim", NEEDS_TEST_SERVER
);
1119 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestHiddenBeforeNavigation
) {
1120 TestHelper("testHiddenBeforeNavigation", "web_view/shim", NO_TEST_SERVER
);
1123 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestRemoveWebviewOnExit
) {
1124 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
1126 // Launch the app and wait until it's ready to load a test.
1127 LoadAndLaunchPlatformApp("web_view/shim", "Launched");
1129 content::WebContents
* embedder_web_contents
= GetFirstAppWindowWebContents();
1130 ASSERT_TRUE(embedder_web_contents
);
1132 GURL::Replacements replace_host
;
1133 std::string
host_str("localhost"); // Must stay in scope with replace_host.
1134 replace_host
.SetHostStr(host_str
);
1136 std::string
guest_path(
1137 "/extensions/platform_apps/web_view/shim/empty_guest.html");
1138 GURL guest_url
= embedded_test_server()->GetURL(guest_path
);
1139 guest_url
= guest_url
.ReplaceComponents(replace_host
);
1141 ui_test_utils::UrlLoadObserver
guest_observer(
1142 guest_url
, content::NotificationService::AllSources());
1144 // Run the test and wait until the guest WebContents is available and has
1145 // finished loading.
1146 ExtensionTestMessageListener
guest_loaded_listener("guest-loaded", false);
1147 EXPECT_TRUE(content::ExecuteScript(
1148 embedder_web_contents
,
1149 "runTest('testRemoveWebviewOnExit')"));
1150 guest_observer
.Wait();
1152 content::Source
<content::NavigationController
> source
=
1153 guest_observer
.source();
1154 EXPECT_TRUE(source
->GetWebContents()->GetRenderProcessHost()->
1157 ASSERT_TRUE(guest_loaded_listener
.WaitUntilSatisfied());
1159 content::WebContentsDestroyedWatcher
destroyed_watcher(
1160 source
->GetWebContents());
1162 // Tell the embedder to kill the guest.
1163 EXPECT_TRUE(content::ExecuteScript(
1164 embedder_web_contents
,
1165 "removeWebviewOnExitDoCrash();"));
1167 // Wait until the guest WebContents is destroyed.
1168 destroyed_watcher
.Wait();
1171 // Remove <webview> immediately after navigating it.
1172 // This is a regression test for http://crbug.com/276023.
1173 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestRemoveWebviewAfterNavigation
) {
1174 TestHelper("testRemoveWebviewAfterNavigation",
1179 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestNavigationToExternalProtocol
) {
1180 TestHelper("testNavigationToExternalProtocol",
1185 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestResizeWebviewResizesContent
) {
1186 TestHelper("testResizeWebviewResizesContent",
1191 // This test makes sure we do not crash if app is closed while interstitial
1192 // page is being shown in guest.
1193 // Disabled under LeakSanitizer due to memory leaks. http://crbug.com/321662
1194 #if defined(LEAK_SANITIZER)
1195 #define MAYBE_InterstitialTeardown DISABLED_InterstitialTeardown
1197 #define MAYBE_InterstitialTeardown InterstitialTeardown
1199 IN_PROC_BROWSER_TEST_F(WebViewTest
, MAYBE_InterstitialTeardown
) {
1201 // Flaky on XP bot http://crbug.com/297014
1202 if (base::win::GetVersion() <= base::win::VERSION_XP
)
1206 // Start a HTTPS server so we can load an interstitial page inside guest.
1207 net::SpawnedTestServer::SSLOptions ssl_options
;
1208 ssl_options
.server_certificate
=
1209 net::SpawnedTestServer::SSLOptions::CERT_MISMATCHED_NAME
;
1210 net::SpawnedTestServer
https_server(
1211 net::SpawnedTestServer::TYPE_HTTPS
, ssl_options
,
1212 base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
1213 ASSERT_TRUE(https_server
.Start());
1215 net::HostPortPair host_and_port
= https_server
.host_port_pair();
1217 LoadAndLaunchPlatformApp("web_view/interstitial_teardown", "EmbedderLoaded");
1219 // Now load the guest.
1220 content::WebContents
* embedder_web_contents
= GetFirstAppWindowWebContents();
1221 ExtensionTestMessageListener
second("GuestAddedToDom", false);
1222 EXPECT_TRUE(content::ExecuteScript(
1223 embedder_web_contents
,
1224 base::StringPrintf("loadGuest(%d);\n", host_and_port
.port())));
1225 ASSERT_TRUE(second
.WaitUntilSatisfied());
1227 // Wait for interstitial page to be shown in guest.
1228 content::WebContents
* guest_web_contents
=
1229 GetGuestViewManager()->WaitForGuestCreated();
1230 ASSERT_TRUE(guest_web_contents
->GetRenderProcessHost()->IsIsolatedGuest());
1231 WaitForInterstitial(guest_web_contents
);
1233 // Now close the app while interstitial page being shown in guest.
1234 apps::AppWindow
* window
= GetFirstAppWindow();
1235 window
->GetBaseWindow()->Close();
1238 IN_PROC_BROWSER_TEST_F(WebViewTest
, ShimSrcAttribute
) {
1239 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/src_attribute"))
1243 // This test verifies that prerendering has been disabled inside <webview>.
1244 // This test is here rather than in PrerenderBrowserTest for testing convenience
1245 // only. If it breaks then this is a bug in the prerenderer.
1246 IN_PROC_BROWSER_TEST_F(WebViewTest
, NoPrerenderer
) {
1247 ASSERT_TRUE(StartEmbeddedTestServer());
1248 content::WebContents
* guest_web_contents
=
1250 "/extensions/platform_apps/web_view/noprerenderer/guest.html",
1251 "web_view/noprerenderer");
1252 ASSERT_TRUE(guest_web_contents
!= NULL
);
1254 PrerenderLinkManager
* prerender_link_manager
=
1255 PrerenderLinkManagerFactory::GetForProfile(
1256 Profile::FromBrowserContext(guest_web_contents
->GetBrowserContext()));
1257 ASSERT_TRUE(prerender_link_manager
!= NULL
);
1258 EXPECT_TRUE(prerender_link_manager
->IsEmpty());
1261 // Verify that existing <webview>'s are detected when the task manager starts
1263 IN_PROC_BROWSER_TEST_F(WebViewTest
, TaskManagerExistingWebView
) {
1264 ASSERT_TRUE(StartEmbeddedTestServer());
1266 LoadGuest("/extensions/platform_apps/web_view/task_manager/guest.html",
1267 "web_view/task_manager");
1269 chrome::ShowTaskManager(browser()); // Show task manager AFTER guest loads.
1271 const char* guest_title
= "WebViewed test content";
1272 const char* app_name
= "<webview> task manager test";
1273 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchWebView(guest_title
)));
1274 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab()));
1275 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchApp(app_name
)));
1276 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchBackground(app_name
)));
1278 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyWebView()));
1279 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
1280 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyApp()));
1281 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyBackground()));
1284 // Verify that the task manager notices the creation of new <webview>'s.
1285 IN_PROC_BROWSER_TEST_F(WebViewTest
, TaskManagerNewWebView
) {
1286 ASSERT_TRUE(StartEmbeddedTestServer());
1288 chrome::ShowTaskManager(browser()); // Show task manager BEFORE guest loads.
1290 LoadGuest("/extensions/platform_apps/web_view/task_manager/guest.html",
1291 "web_view/task_manager");
1293 const char* guest_title
= "WebViewed test content";
1294 const char* app_name
= "<webview> task manager test";
1295 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchWebView(guest_title
)));
1296 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab()));
1297 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchApp(app_name
)));
1298 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchBackground(app_name
)));
1300 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyWebView()));
1301 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab()));
1302 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyApp()));
1303 ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyBackground()));
1306 // This tests cookie isolation for packaged apps with webview tags. It navigates
1307 // the main browser window to a page that sets a cookie and loads an app with
1308 // multiple webview tags. Each tag sets a cookie and the test checks the proper
1309 // storage isolation is enforced.
1310 IN_PROC_BROWSER_TEST_F(WebViewTest
, CookieIsolation
) {
1311 ASSERT_TRUE(StartEmbeddedTestServer());
1312 const std::string kExpire
=
1313 "var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);";
1314 std::string
cookie_script1(kExpire
);
1315 cookie_script1
.append(
1316 "document.cookie = 'guest1=true; path=/; expires=' + expire + ';';");
1317 std::string
cookie_script2(kExpire
);
1318 cookie_script2
.append(
1319 "document.cookie = 'guest2=true; path=/; expires=' + expire + ';';");
1321 GURL::Replacements replace_host
;
1322 std::string
host_str("localhost"); // Must stay in scope with replace_host.
1323 replace_host
.SetHostStr(host_str
);
1325 GURL set_cookie_url
= embedded_test_server()->GetURL(
1326 "/extensions/platform_apps/isolation/set_cookie.html");
1327 set_cookie_url
= set_cookie_url
.ReplaceComponents(replace_host
);
1329 // The first two partitions will be used to set cookies and ensure they are
1330 // shared. The named partition is used to ensure that cookies are isolated
1331 // between partitions within the same app.
1332 content::WebContents
* cookie_contents1
;
1333 content::WebContents
* cookie_contents2
;
1334 content::WebContents
* named_partition_contents1
;
1335 content::WebContents
* named_partition_contents2
;
1337 NavigateAndOpenAppForIsolation(set_cookie_url
, &cookie_contents1
,
1338 &cookie_contents2
, &named_partition_contents1
,
1339 &named_partition_contents2
, NULL
, NULL
, NULL
);
1341 EXPECT_TRUE(content::ExecuteScript(cookie_contents1
, cookie_script1
));
1342 EXPECT_TRUE(content::ExecuteScript(cookie_contents2
, cookie_script2
));
1345 std::string cookie_value
;
1347 // Test the regular browser context to ensure we have only one cookie.
1348 ui_test_utils::GetCookies(GURL("http://localhost"),
1349 browser()->tab_strip_model()->GetWebContentsAt(0),
1350 &cookie_size
, &cookie_value
);
1351 EXPECT_EQ("testCookie=1", cookie_value
);
1353 // The default behavior is to combine webview tags with no explicit partition
1354 // declaration into the same in-memory partition. Test the webview tags to
1355 // ensure we have properly set the cookies and we have both cookies in both
1357 ui_test_utils::GetCookies(GURL("http://localhost"),
1359 &cookie_size
, &cookie_value
);
1360 EXPECT_EQ("guest1=true; guest2=true", cookie_value
);
1362 ui_test_utils::GetCookies(GURL("http://localhost"),
1364 &cookie_size
, &cookie_value
);
1365 EXPECT_EQ("guest1=true; guest2=true", cookie_value
);
1367 // The third tag should not have any cookies as it is in a separate partition.
1368 ui_test_utils::GetCookies(GURL("http://localhost"),
1369 named_partition_contents1
,
1370 &cookie_size
, &cookie_value
);
1371 EXPECT_EQ("", cookie_value
);
1374 // This tests that in-memory storage partitions are reset on browser restart,
1375 // but persistent ones maintain state for cookies and HTML5 storage.
1376 IN_PROC_BROWSER_TEST_F(WebViewTest
, PRE_StoragePersistence
) {
1377 ASSERT_TRUE(StartEmbeddedTestServer());
1378 const std::string kExpire
=
1379 "var expire = new Date(Date.now() + 24 * 60 * 60 * 1000);";
1380 std::string
cookie_script1(kExpire
);
1381 cookie_script1
.append(
1382 "document.cookie = 'inmemory=true; path=/; expires=' + expire + ';';");
1383 std::string
cookie_script2(kExpire
);
1384 cookie_script2
.append(
1385 "document.cookie = 'persist1=true; path=/; expires=' + expire + ';';");
1386 std::string
cookie_script3(kExpire
);
1387 cookie_script3
.append(
1388 "document.cookie = 'persist2=true; path=/; expires=' + expire + ';';");
1390 // We don't care where the main browser is on this test.
1391 GURL
blank_url("about:blank");
1393 // The first two partitions will be used to set cookies and ensure they are
1394 // shared. The named partition is used to ensure that cookies are isolated
1395 // between partitions within the same app.
1396 content::WebContents
* cookie_contents1
;
1397 content::WebContents
* cookie_contents2
;
1398 content::WebContents
* named_partition_contents1
;
1399 content::WebContents
* named_partition_contents2
;
1400 content::WebContents
* persistent_partition_contents1
;
1401 content::WebContents
* persistent_partition_contents2
;
1402 content::WebContents
* persistent_partition_contents3
;
1403 NavigateAndOpenAppForIsolation(blank_url
, &cookie_contents1
,
1404 &cookie_contents2
, &named_partition_contents1
,
1405 &named_partition_contents2
,
1406 &persistent_partition_contents1
,
1407 &persistent_partition_contents2
,
1408 &persistent_partition_contents3
);
1410 // Set the inmemory=true cookie for tags with inmemory partitions.
1411 EXPECT_TRUE(content::ExecuteScript(cookie_contents1
, cookie_script1
));
1412 EXPECT_TRUE(content::ExecuteScript(named_partition_contents1
,
1415 // For the two different persistent storage partitions, set the
1416 // two different cookies so we can check that they aren't comingled below.
1417 EXPECT_TRUE(content::ExecuteScript(persistent_partition_contents1
,
1420 EXPECT_TRUE(content::ExecuteScript(persistent_partition_contents3
,
1424 std::string cookie_value
;
1426 // Check that all in-memory partitions have a cookie set.
1427 ui_test_utils::GetCookies(GURL("http://localhost"),
1429 &cookie_size
, &cookie_value
);
1430 EXPECT_EQ("inmemory=true", cookie_value
);
1431 ui_test_utils::GetCookies(GURL("http://localhost"),
1433 &cookie_size
, &cookie_value
);
1434 EXPECT_EQ("inmemory=true", cookie_value
);
1435 ui_test_utils::GetCookies(GURL("http://localhost"),
1436 named_partition_contents1
,
1437 &cookie_size
, &cookie_value
);
1438 EXPECT_EQ("inmemory=true", cookie_value
);
1439 ui_test_utils::GetCookies(GURL("http://localhost"),
1440 named_partition_contents2
,
1441 &cookie_size
, &cookie_value
);
1442 EXPECT_EQ("inmemory=true", cookie_value
);
1444 // Check that all persistent partitions kept their state.
1445 ui_test_utils::GetCookies(GURL("http://localhost"),
1446 persistent_partition_contents1
,
1447 &cookie_size
, &cookie_value
);
1448 EXPECT_EQ("persist1=true", cookie_value
);
1449 ui_test_utils::GetCookies(GURL("http://localhost"),
1450 persistent_partition_contents2
,
1451 &cookie_size
, &cookie_value
);
1452 EXPECT_EQ("persist1=true", cookie_value
);
1453 ui_test_utils::GetCookies(GURL("http://localhost"),
1454 persistent_partition_contents3
,
1455 &cookie_size
, &cookie_value
);
1456 EXPECT_EQ("persist2=true", cookie_value
);
1459 // This is the post-reset portion of the StoragePersistence test. See
1460 // PRE_StoragePersistence for main comment.
1461 #if defined(OS_CHROMEOS)
1462 // http://crbug.com/223888
1463 #define MAYBE_StoragePersistence DISABLED_StoragePersistence
1465 #define MAYBE_StoragePersistence StoragePersistence
1467 IN_PROC_BROWSER_TEST_F(WebViewTest
, MAYBE_StoragePersistence
) {
1468 ASSERT_TRUE(StartEmbeddedTestServer());
1470 // We don't care where the main browser is on this test.
1471 GURL
blank_url("about:blank");
1473 // The first two partitions will be used to set cookies and ensure they are
1474 // shared. The named partition is used to ensure that cookies are isolated
1475 // between partitions within the same app.
1476 content::WebContents
* cookie_contents1
;
1477 content::WebContents
* cookie_contents2
;
1478 content::WebContents
* named_partition_contents1
;
1479 content::WebContents
* named_partition_contents2
;
1480 content::WebContents
* persistent_partition_contents1
;
1481 content::WebContents
* persistent_partition_contents2
;
1482 content::WebContents
* persistent_partition_contents3
;
1483 NavigateAndOpenAppForIsolation(blank_url
, &cookie_contents1
,
1484 &cookie_contents2
, &named_partition_contents1
,
1485 &named_partition_contents2
,
1486 &persistent_partition_contents1
,
1487 &persistent_partition_contents2
,
1488 &persistent_partition_contents3
);
1491 std::string cookie_value
;
1493 // Check that all in-memory partitions lost their state.
1494 ui_test_utils::GetCookies(GURL("http://localhost"),
1496 &cookie_size
, &cookie_value
);
1497 EXPECT_EQ("", cookie_value
);
1498 ui_test_utils::GetCookies(GURL("http://localhost"),
1500 &cookie_size
, &cookie_value
);
1501 EXPECT_EQ("", cookie_value
);
1502 ui_test_utils::GetCookies(GURL("http://localhost"),
1503 named_partition_contents1
,
1504 &cookie_size
, &cookie_value
);
1505 EXPECT_EQ("", cookie_value
);
1506 ui_test_utils::GetCookies(GURL("http://localhost"),
1507 named_partition_contents2
,
1508 &cookie_size
, &cookie_value
);
1509 EXPECT_EQ("", cookie_value
);
1511 // Check that all persistent partitions kept their state.
1512 ui_test_utils::GetCookies(GURL("http://localhost"),
1513 persistent_partition_contents1
,
1514 &cookie_size
, &cookie_value
);
1515 EXPECT_EQ("persist1=true", cookie_value
);
1516 ui_test_utils::GetCookies(GURL("http://localhost"),
1517 persistent_partition_contents2
,
1518 &cookie_size
, &cookie_value
);
1519 EXPECT_EQ("persist1=true", cookie_value
);
1520 ui_test_utils::GetCookies(GURL("http://localhost"),
1521 persistent_partition_contents3
,
1522 &cookie_size
, &cookie_value
);
1523 EXPECT_EQ("persist2=true", cookie_value
);
1526 // This tests DOM storage isolation for packaged apps with webview tags. It
1527 // loads an app with multiple webview tags and each tag sets DOM storage
1528 // entries, which the test checks to ensure proper storage isolation is
1530 IN_PROC_BROWSER_TEST_F(WebViewTest
, DOMStorageIsolation
) {
1531 ASSERT_TRUE(StartEmbeddedTestServer());
1532 GURL regular_url
= embedded_test_server()->GetURL("/title1.html");
1535 std::string
get_local_storage("window.domAutomationController.send("
1536 "window.localStorage.getItem('foo') || 'badval')");
1537 std::string
get_session_storage("window.domAutomationController.send("
1538 "window.sessionStorage.getItem('bar') || 'badval')");
1540 content::WebContents
* default_tag_contents1
;
1541 content::WebContents
* default_tag_contents2
;
1542 content::WebContents
* storage_contents1
;
1543 content::WebContents
* storage_contents2
;
1545 NavigateAndOpenAppForIsolation(regular_url
, &default_tag_contents1
,
1546 &default_tag_contents2
, &storage_contents1
,
1547 &storage_contents2
, NULL
, NULL
, NULL
);
1549 // Initialize the storage for the first of the two tags that share a storage
1551 EXPECT_TRUE(content::ExecuteScript(storage_contents1
,
1552 "initDomStorage('page1')"));
1554 // Let's test that the expected values are present in the first tag, as they
1555 // will be overwritten once we call the initDomStorage on the second tag.
1556 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents1
,
1557 get_local_storage
.c_str(),
1559 EXPECT_STREQ("local-page1", output
.c_str());
1560 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents1
,
1561 get_session_storage
.c_str(),
1563 EXPECT_STREQ("session-page1", output
.c_str());
1565 // Now, init the storage in the second tag in the same storage partition,
1566 // which will overwrite the shared localStorage.
1567 EXPECT_TRUE(content::ExecuteScript(storage_contents2
,
1568 "initDomStorage('page2')"));
1570 // The localStorage value now should reflect the one written through the
1572 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents1
,
1573 get_local_storage
.c_str(),
1575 EXPECT_STREQ("local-page2", output
.c_str());
1576 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents2
,
1577 get_local_storage
.c_str(),
1579 EXPECT_STREQ("local-page2", output
.c_str());
1581 // Session storage is not shared though, as each webview tag has separate
1582 // instance, even if they are in the same storage partition.
1583 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents1
,
1584 get_session_storage
.c_str(),
1586 EXPECT_STREQ("session-page1", output
.c_str());
1587 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents2
,
1588 get_session_storage
.c_str(),
1590 EXPECT_STREQ("session-page2", output
.c_str());
1592 // Also, let's check that the main browser and another tag that doesn't share
1593 // the same partition don't have those values stored.
1594 EXPECT_TRUE(ExecuteScriptAndExtractString(
1595 browser()->tab_strip_model()->GetWebContentsAt(0),
1596 get_local_storage
.c_str(),
1598 EXPECT_STREQ("badval", output
.c_str());
1599 EXPECT_TRUE(ExecuteScriptAndExtractString(
1600 browser()->tab_strip_model()->GetWebContentsAt(0),
1601 get_session_storage
.c_str(),
1603 EXPECT_STREQ("badval", output
.c_str());
1604 EXPECT_TRUE(ExecuteScriptAndExtractString(default_tag_contents1
,
1605 get_local_storage
.c_str(),
1607 EXPECT_STREQ("badval", output
.c_str());
1608 EXPECT_TRUE(ExecuteScriptAndExtractString(default_tag_contents1
,
1609 get_session_storage
.c_str(),
1611 EXPECT_STREQ("badval", output
.c_str());
1614 // This tests IndexedDB isolation for packaged apps with webview tags. It loads
1615 // an app with multiple webview tags and each tag creates an IndexedDB record,
1616 // which the test checks to ensure proper storage isolation is enforced.
1617 IN_PROC_BROWSER_TEST_F(WebViewTest
, IndexedDBIsolation
) {
1618 ASSERT_TRUE(StartEmbeddedTestServer());
1619 GURL regular_url
= embedded_test_server()->GetURL("/title1.html");
1621 content::WebContents
* default_tag_contents1
;
1622 content::WebContents
* default_tag_contents2
;
1623 content::WebContents
* storage_contents1
;
1624 content::WebContents
* storage_contents2
;
1626 NavigateAndOpenAppForIsolation(regular_url
, &default_tag_contents1
,
1627 &default_tag_contents2
, &storage_contents1
,
1628 &storage_contents2
, NULL
, NULL
, NULL
);
1630 // Initialize the storage for the first of the two tags that share a storage
1632 ExecuteScriptWaitForTitle(storage_contents1
, "initIDB()", "idb created");
1633 ExecuteScriptWaitForTitle(storage_contents1
, "addItemIDB(7, 'page1')",
1634 "addItemIDB complete");
1635 ExecuteScriptWaitForTitle(storage_contents1
, "readItemIDB(7)",
1636 "readItemIDB complete");
1639 std::string
get_value(
1640 "window.domAutomationController.send(getValueIDB() || 'badval')");
1642 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents1
,
1643 get_value
.c_str(), &output
));
1644 EXPECT_STREQ("page1", output
.c_str());
1646 // Initialize the db in the second tag.
1647 ExecuteScriptWaitForTitle(storage_contents2
, "initIDB()", "idb open");
1649 // Since we share a partition, reading the value should return the existing
1651 ExecuteScriptWaitForTitle(storage_contents2
, "readItemIDB(7)",
1652 "readItemIDB complete");
1653 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents2
,
1654 get_value
.c_str(), &output
));
1655 EXPECT_STREQ("page1", output
.c_str());
1657 // Now write through the second tag and read it back.
1658 ExecuteScriptWaitForTitle(storage_contents2
, "addItemIDB(7, 'page2')",
1659 "addItemIDB complete");
1660 ExecuteScriptWaitForTitle(storage_contents2
, "readItemIDB(7)",
1661 "readItemIDB complete");
1662 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents2
,
1663 get_value
.c_str(), &output
));
1664 EXPECT_STREQ("page2", output
.c_str());
1666 // Reset the document title, otherwise the next call will not see a change and
1667 // will hang waiting for it.
1668 EXPECT_TRUE(content::ExecuteScript(storage_contents1
,
1669 "document.title = 'foo'"));
1671 // Read through the first tag to ensure we have the second value.
1672 ExecuteScriptWaitForTitle(storage_contents1
, "readItemIDB(7)",
1673 "readItemIDB complete");
1674 EXPECT_TRUE(ExecuteScriptAndExtractString(storage_contents1
,
1675 get_value
.c_str(), &output
));
1676 EXPECT_STREQ("page2", output
.c_str());
1678 // Now, let's confirm there is no database in the main browser and another
1679 // tag that doesn't share the same partition. Due to the IndexedDB API design,
1680 // open will succeed, but the version will be 1, since it creates the database
1681 // if it is not found. The two tags use database version 3, so we avoid
1683 const char* script
=
1684 "indexedDB.open('isolation').onsuccess = function(e) {"
1685 " if (e.target.result.version == 1)"
1686 " document.title = 'db not found';"
1688 " document.title = 'error';"
1690 ExecuteScriptWaitForTitle(browser()->tab_strip_model()->GetWebContentsAt(0),
1691 script
, "db not found");
1692 ExecuteScriptWaitForTitle(default_tag_contents1
, script
, "db not found");
1695 // This test ensures that closing app window on 'loadcommit' does not crash.
1696 // The test launches an app with guest and closes the window on loadcommit. It
1697 // then launches the app window again. The process is repeated 3 times.
1698 // http://crbug.com/291278
1700 #define MAYBE_CloseOnLoadcommit DISABLED_CloseOnLoadcommit
1702 #define MAYBE_CloseOnLoadcommit CloseOnLoadcommit
1704 IN_PROC_BROWSER_TEST_F(WebViewTest
, MAYBE_CloseOnLoadcommit
) {
1705 LoadAndLaunchPlatformApp("web_view/close_on_loadcommit",
1706 "done-close-on-loadcommit");
1709 IN_PROC_BROWSER_TEST_F(WebViewTest
, MediaAccessAPIDeny_TestDeny
) {
1710 MediaAccessAPIDenyTestHelper("testDeny");
1713 IN_PROC_BROWSER_TEST_F(WebViewTest
,
1714 MediaAccessAPIDeny_TestDenyThenAllowThrows
) {
1715 MediaAccessAPIDenyTestHelper("testDenyThenAllowThrows");
1719 IN_PROC_BROWSER_TEST_F(WebViewTest
,
1720 MediaAccessAPIDeny_TestDenyWithPreventDefault
) {
1721 MediaAccessAPIDenyTestHelper("testDenyWithPreventDefault");
1724 IN_PROC_BROWSER_TEST_F(WebViewTest
,
1725 MediaAccessAPIDeny_TestNoListenersImplyDeny
) {
1726 MediaAccessAPIDenyTestHelper("testNoListenersImplyDeny");
1729 IN_PROC_BROWSER_TEST_F(WebViewTest
,
1730 MediaAccessAPIDeny_TestNoPreventDefaultImpliesDeny
) {
1731 MediaAccessAPIDenyTestHelper("testNoPreventDefaultImpliesDeny");
1734 void WebViewTest::MediaAccessAPIAllowTestHelper(const std::string
& test_name
) {
1735 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
1736 LoadAndLaunchPlatformApp("web_view/media_access/allow", "Launched");
1738 content::WebContents
* embedder_web_contents
= GetFirstAppWindowWebContents();
1739 ASSERT_TRUE(embedder_web_contents
);
1740 scoped_ptr
<MockWebContentsDelegate
> mock(new MockWebContentsDelegate());
1741 embedder_web_contents
->SetDelegate(mock
.get());
1743 ExtensionTestMessageListener
done_listener("TEST_PASSED", false);
1744 done_listener
.set_failure_message("TEST_FAILED");
1746 content::ExecuteScript(
1747 embedder_web_contents
,
1748 base::StringPrintf("startAllowTest('%s')",
1749 test_name
.c_str())));
1750 ASSERT_TRUE(done_listener
.WaitUntilSatisfied());
1752 mock
->WaitForSetMediaPermission();
1755 IN_PROC_BROWSER_TEST_F(WebViewTest
, ContextMenusAPI_Basic
) {
1756 LoadAppWithGuest("web_view/context_menus/basic");
1758 content::WebContents
* guest_web_contents
= GetGuestWebContents();
1759 content::WebContents
* embedder
= GetEmbedderWebContents();
1760 ASSERT_TRUE(embedder
);
1762 // 1. Basic property test.
1763 ExecuteScriptWaitForTitle(embedder
, "checkProperties()", "ITEM_CHECKED");
1765 // 2. Create a menu item and wait for created callback to be called.
1766 ExecuteScriptWaitForTitle(embedder
, "createMenuItem()", "ITEM_CREATED");
1768 // 3. Click the created item, wait for the click handlers to fire from JS.
1769 ExtensionTestMessageListener
click_listener("ITEM_CLICKED", false);
1770 GURL
page_url("http://www.google.com");
1771 // Create and build our test context menu.
1772 scoped_ptr
<TestRenderViewContextMenu
> menu(TestRenderViewContextMenu::Create(
1773 guest_web_contents
, page_url
, GURL(), GURL()));
1775 // Look for the extension item in the menu, and execute it.
1776 int command_id
= ContextMenuMatcher::ConvertToExtensionsCustomCommandId(0);
1777 ASSERT_TRUE(menu
->IsCommandIdEnabled(command_id
));
1778 menu
->ExecuteCommand(command_id
, 0);
1780 // Wait for embedder's script to tell us its onclick fired, it does
1781 // chrome.test.sendMessage('ITEM_CLICKED')
1782 ASSERT_TRUE(click_listener
.WaitUntilSatisfied());
1784 // 4. Update the item's title and verify.
1785 ExecuteScriptWaitForTitle(embedder
, "updateMenuItem()", "ITEM_UPDATED");
1786 MenuItem::List items
= GetItems();
1787 ASSERT_EQ(1u, items
.size());
1788 MenuItem
* item
= items
.at(0);
1789 EXPECT_EQ("new_title", item
->title());
1791 // 5. Remove the item.
1792 ExecuteScriptWaitForTitle(embedder
, "removeItem()", "ITEM_REMOVED");
1793 MenuItem::List items_after_removal
= GetItems();
1794 ASSERT_EQ(0u, items_after_removal
.size());
1796 // 6. Add some more items.
1797 ExecuteScriptWaitForTitle(
1798 embedder
, "createThreeMenuItems()", "ITEM_MULTIPLE_CREATED");
1799 MenuItem::List items_after_insertion
= GetItems();
1800 ASSERT_EQ(3u, items_after_insertion
.size());
1802 // 7. Test removeAll().
1803 ExecuteScriptWaitForTitle(embedder
, "removeAllItems()", "ITEM_ALL_REMOVED");
1804 MenuItem::List items_after_all_removal
= GetItems();
1805 ASSERT_EQ(0u, items_after_all_removal
.size());
1808 IN_PROC_BROWSER_TEST_F(WebViewTest
, MediaAccessAPIAllow_TestAllow
) {
1809 MediaAccessAPIAllowTestHelper("testAllow");
1812 IN_PROC_BROWSER_TEST_F(WebViewTest
, MediaAccessAPIAllow_TestAllowAndThenDeny
) {
1813 MediaAccessAPIAllowTestHelper("testAllowAndThenDeny");
1816 IN_PROC_BROWSER_TEST_F(WebViewTest
, MediaAccessAPIAllow_TestAllowTwice
) {
1817 MediaAccessAPIAllowTestHelper("testAllowTwice");
1820 IN_PROC_BROWSER_TEST_F(WebViewTest
, MediaAccessAPIAllow_TestAllowAsync
) {
1821 MediaAccessAPIAllowTestHelper("testAllowAsync");
1824 // Checks that window.screenX/screenY/screenLeft/screenTop works correctly for
1826 IN_PROC_BROWSER_TEST_F(WebViewTest
, ScreenCoordinates
) {
1827 ASSERT_TRUE(RunPlatformAppTestWithArg(
1828 "platform_apps/web_view/common", "screen_coordinates"))
1832 #if defined(OS_CHROMEOS)
1833 IN_PROC_BROWSER_TEST_F(WebViewTest
, ChromeVoxInjection
) {
1835 chromeos::AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
1837 ASSERT_TRUE(StartEmbeddedTestServer());
1838 content::WebContents
* guest_web_contents
= LoadGuest(
1839 "/extensions/platform_apps/web_view/chromevox_injection/guest.html",
1840 "web_view/chromevox_injection");
1841 ASSERT_TRUE(guest_web_contents
);
1843 chromeos::SpeechMonitor monitor
;
1844 chromeos::AccessibilityManager::Get()->EnableSpokenFeedback(
1845 true, ash::A11Y_NOTIFICATION_NONE
);
1846 EXPECT_TRUE(monitor
.SkipChromeVoxEnabledMessage());
1848 EXPECT_EQ("chrome vox test title", monitor
.GetNextUtterance());
1852 // Flaky on Windows. http://crbug.com/303966
1854 #define MAYBE_TearDownTest DISABLED_TearDownTest
1856 #define MAYBE_TearDownTest TearDownTest
1858 IN_PROC_BROWSER_TEST_F(WebViewTest
, MAYBE_TearDownTest
) {
1859 const extensions::Extension
* extension
=
1860 LoadAndLaunchPlatformApp("web_view/teardown", "guest-loaded");
1861 apps::AppWindow
* window
= NULL
;
1862 if (!GetAppWindowCount())
1863 window
= CreateAppWindow(extension
);
1865 window
= GetFirstAppWindow();
1866 CloseAppWindow(window
);
1868 // Load the app again.
1869 LoadAndLaunchPlatformApp("web_view/teardown", "guest-loaded");
1872 // In following GeolocationAPIEmbedderHasNoAccess* tests, embedder (i.e. the
1873 // platform app) does not have geolocation permission for this test.
1874 // No matter what the API does, geolocation permission would be denied.
1875 // Note that the test name prefix must be "GeolocationAPI".
1876 IN_PROC_BROWSER_TEST_F(WebViewTest
, GeolocationAPIEmbedderHasNoAccessAllow
) {
1877 TestHelper("testDenyDenies",
1878 "web_view/geolocation/embedder_has_no_permission",
1882 IN_PROC_BROWSER_TEST_F(WebViewTest
, GeolocationAPIEmbedderHasNoAccessDeny
) {
1883 TestHelper("testDenyDenies",
1884 "web_view/geolocation/embedder_has_no_permission",
1888 // In following GeolocationAPIEmbedderHasAccess* tests, embedder (i.e. the
1889 // platform app) has geolocation permission
1891 // Note that these test names must be "GeolocationAPI" prefixed (b/c we mock out
1892 // geolocation in this case).
1894 // Also note that these are run separately because OverrideGeolocation() doesn't
1895 // mock out geolocation for multiple navigator.geolocation calls properly and
1896 // the tests become flaky.
1897 // GeolocationAPI* test 1 of 3.
1898 IN_PROC_BROWSER_TEST_F(WebViewTest
, GeolocationAPIEmbedderHasAccessAllow
) {
1899 TestHelper("testAllow",
1900 "web_view/geolocation/embedder_has_permission",
1904 // GeolocationAPI* test 2 of 3.
1905 IN_PROC_BROWSER_TEST_F(WebViewTest
, GeolocationAPIEmbedderHasAccessDeny
) {
1906 TestHelper("testDeny",
1907 "web_view/geolocation/embedder_has_permission",
1911 // GeolocationAPI* test 3 of 3.
1912 IN_PROC_BROWSER_TEST_F(WebViewTest
,
1913 GeolocationAPIEmbedderHasAccessMultipleBridgeIdAllow
) {
1914 TestHelper("testMultipleBridgeIdAllow",
1915 "web_view/geolocation/embedder_has_permission",
1920 // BrowserPluginGeolocationPermissionContext::CancelGeolocationPermissionRequest
1921 // is handled correctly (and does not crash).
1922 IN_PROC_BROWSER_TEST_F(WebViewTest
, GeolocationAPICancelGeolocation
) {
1923 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
1924 ASSERT_TRUE(RunPlatformAppTest(
1925 "platform_apps/web_view/geolocation/cancel_request")) << message_
;
1928 IN_PROC_BROWSER_TEST_F(WebViewTest
, DISABLED_GeolocationRequestGone
) {
1929 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
1930 ASSERT_TRUE(RunPlatformAppTest(
1931 "platform_apps/web_view/geolocation/geolocation_request_gone"))
1935 // In following FilesystemAPIRequestFromMainThread* tests, guest request
1936 // filesystem access from main thread of the guest.
1937 // FileSystemAPIRequestFromMainThread* test 1 of 3
1938 IN_PROC_BROWSER_TEST_F(WebViewTest
, FileSystemAPIRequestFromMainThreadAllow
) {
1939 TestHelper("testAllow", "web_view/filesystem/main", NEEDS_TEST_SERVER
);
1942 // FileSystemAPIRequestFromMainThread* test 2 of 3.
1943 IN_PROC_BROWSER_TEST_F(WebViewTest
, FileSystemAPIRequestFromMainThreadDeny
) {
1944 TestHelper("testDeny", "web_view/filesystem/main", NEEDS_TEST_SERVER
);
1947 // FileSystemAPIRequestFromMainThread* test 3 of 3.
1948 IN_PROC_BROWSER_TEST_F(WebViewTest
,
1949 FileSystemAPIRequestFromMainThreadDefaultAllow
) {
1950 TestHelper("testDefaultAllow", "web_view/filesystem/main", NEEDS_TEST_SERVER
);
1953 // In following FilesystemAPIRequestFromWorker* tests, guest create a worker
1954 // to request filesystem access from worker thread.
1955 // FileSystemAPIRequestFromWorker* test 1 of 3
1956 IN_PROC_BROWSER_TEST_F(WebViewTest
, FileSystemAPIRequestFromWorkerAllow
) {
1957 TestHelper("testAllow", "web_view/filesystem/worker", NEEDS_TEST_SERVER
);
1960 // FileSystemAPIRequestFromWorker* test 2 of 3.
1961 IN_PROC_BROWSER_TEST_F(WebViewTest
, FileSystemAPIRequestFromWorkerDeny
) {
1962 TestHelper("testDeny", "web_view/filesystem/worker", NEEDS_TEST_SERVER
);
1965 // FileSystemAPIRequestFromWorker* test 3 of 3.
1966 IN_PROC_BROWSER_TEST_F(WebViewTest
,
1967 FileSystemAPIRequestFromWorkerDefaultAllow
) {
1969 "testDefaultAllow", "web_view/filesystem/worker", NEEDS_TEST_SERVER
);
1972 // In following FilesystemAPIRequestFromSharedWorkerOfSingleWebViewGuest* tests,
1973 // embedder contains a single webview guest. The guest creates a shared worker
1974 // to request filesystem access from worker thread.
1975 // FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuest* test 1 of 3
1976 IN_PROC_BROWSER_TEST_F(
1978 FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuestAllow
) {
1979 TestHelper("testAllow",
1980 "web_view/filesystem/shared_worker/single",
1984 // FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuest* test 2 of 3.
1985 IN_PROC_BROWSER_TEST_F(
1987 FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuestDeny
) {
1988 TestHelper("testDeny",
1989 "web_view/filesystem/shared_worker/single",
1993 // FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuest* test 3 of 3.
1994 IN_PROC_BROWSER_TEST_F(
1996 FileSystemAPIRequestFromSharedWorkerOfSingleWebViewGuestDefaultAllow
) {
1999 "web_view/filesystem/shared_worker/single",
2003 // In following FilesystemAPIRequestFromSharedWorkerOfMultiWebViewGuests* tests,
2004 // embedder contains mutiple webview guests. Each guest creates a shared worker
2005 // to request filesystem access from worker thread.
2006 // FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuests* test 1 of 3
2007 IN_PROC_BROWSER_TEST_F(
2009 FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuestsAllow
) {
2010 TestHelper("testAllow",
2011 "web_view/filesystem/shared_worker/multiple",
2015 // FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuests* test 2 of 3.
2016 IN_PROC_BROWSER_TEST_F(
2018 FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuestsDeny
) {
2019 TestHelper("testDeny",
2020 "web_view/filesystem/shared_worker/multiple",
2024 // FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuests* test 3 of 3.
2025 IN_PROC_BROWSER_TEST_F(
2027 FileSystemAPIRequestFromSharedWorkerOfMultiWebViewGuestsDefaultAllow
) {
2030 "web_view/filesystem/shared_worker/multiple",
2034 IN_PROC_BROWSER_TEST_F(WebViewTest
, ClearData
) {
2036 // Flaky on XP bot http://crbug.com/282674
2037 if (base::win::GetVersion() <= base::win::VERSION_XP
)
2041 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
2042 ASSERT_TRUE(RunPlatformAppTestWithArg(
2043 "platform_apps/web_view/common", "cleardata"))
2047 // This test is disabled on Win due to being flaky. http://crbug.com/294592
2049 #define MAYBE_ConsoleMessage DISABLED_ConsoleMessage
2051 #define MAYBE_ConsoleMessage ConsoleMessage
2053 IN_PROC_BROWSER_TEST_F(WebViewTest
, MAYBE_ConsoleMessage
) {
2054 ASSERT_TRUE(RunPlatformAppTestWithArg(
2055 "platform_apps/web_view/common", "console_messages"))
2059 IN_PROC_BROWSER_TEST_F(WebViewTest
, DownloadPermission
) {
2060 ASSERT_TRUE(StartEmbeddedTestServer()); // For serving guest pages.
2061 content::WebContents
* guest_web_contents
=
2062 LoadGuest("/extensions/platform_apps/web_view/download/guest.html",
2063 "web_view/download");
2064 ASSERT_TRUE(guest_web_contents
);
2066 // Replace WebContentsDelegate with mock version so we can intercept download
2068 content::WebContentsDelegate
* delegate
= guest_web_contents
->GetDelegate();
2069 scoped_ptr
<MockDownloadWebContentsDelegate
>
2070 mock_delegate(new MockDownloadWebContentsDelegate(delegate
));
2071 guest_web_contents
->SetDelegate(mock_delegate
.get());
2074 // 1. Guest requests a download that its embedder denies.
2075 EXPECT_TRUE(content::ExecuteScript(guest_web_contents
,
2076 "startDownload('download-link-1')"));
2077 mock_delegate
->WaitForCanDownload(false); // Expect to not allow.
2078 mock_delegate
->Reset();
2080 // 2. Guest requests a download that its embedder allows.
2081 EXPECT_TRUE(content::ExecuteScript(guest_web_contents
,
2082 "startDownload('download-link-2')"));
2083 mock_delegate
->WaitForCanDownload(true); // Expect to allow.
2084 mock_delegate
->Reset();
2086 // 3. Guest requests a download that its embedder ignores, this implies deny.
2087 EXPECT_TRUE(content::ExecuteScript(guest_web_contents
,
2088 "startDownload('download-link-3')"));
2089 mock_delegate
->WaitForCanDownload(false); // Expect to not allow.
2092 // This test makes sure loading <webview> does not crash when there is an
2093 // extension which has content script whitelisted/forced.
2094 IN_PROC_BROWSER_TEST_F(WebViewTest
, WhitelistedContentScript
) {
2095 // Whitelist the extension for running content script we are going to load.
2096 extensions::ExtensionsClient::ScriptingWhitelist whitelist
;
2097 const std::string extension_id
= "imeongpbjoodlnmlakaldhlcmijmhpbb";
2098 whitelist
.push_back(extension_id
);
2099 extensions::ExtensionsClient::Get()->SetScriptingWhitelist(whitelist
);
2101 // Load the extension.
2102 const extensions::Extension
* content_script_whitelisted_extension
=
2103 LoadExtension(test_data_dir_
.AppendASCII(
2104 "platform_apps/web_view/extension_api/content_script"));
2105 ASSERT_TRUE(content_script_whitelisted_extension
);
2106 ASSERT_EQ(extension_id
, content_script_whitelisted_extension
->id());
2108 // Now load an app with <webview>.
2109 LoadAndLaunchPlatformApp("web_view/content_script_whitelisted",
2113 IN_PROC_BROWSER_TEST_F(WebViewTest
, SetPropertyOnDocumentReady
) {
2114 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/document_ready"))
2118 IN_PROC_BROWSER_TEST_F(WebViewTest
, SetPropertyOnDocumentInteractive
) {
2119 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/document_interactive"))
2123 IN_PROC_BROWSER_TEST_F(WebViewTest
, SpeechRecognitionAPI_HasPermissionAllow
) {
2125 RunPlatformAppTestWithArg("platform_apps/web_view/speech_recognition_api",
2130 IN_PROC_BROWSER_TEST_F(WebViewTest
, SpeechRecognitionAPI_HasPermissionDeny
) {
2132 RunPlatformAppTestWithArg("platform_apps/web_view/speech_recognition_api",
2137 IN_PROC_BROWSER_TEST_F(WebViewTest
, SpeechRecognitionAPI_NoPermission
) {
2139 RunPlatformAppTestWithArg("platform_apps/web_view/common",
2140 "speech_recognition_api_no_permission"))
2144 // Tests overriding user agent.
2145 IN_PROC_BROWSER_TEST_F(WebViewTest
, UserAgent
) {
2146 ASSERT_TRUE(RunPlatformAppTestWithArg(
2147 "platform_apps/web_view/common", "useragent")) << message_
;
2150 IN_PROC_BROWSER_TEST_F(WebViewTest
, UserAgent_NewWindow
) {
2151 ASSERT_TRUE(RunPlatformAppTestWithArg(
2152 "platform_apps/web_view/common",
2153 "useragent_newwindow")) << message_
;
2156 IN_PROC_BROWSER_TEST_F(WebViewTest
, NoPermission
) {
2157 ASSERT_TRUE(RunPlatformAppTest("platform_apps/web_view/nopermission"))
2161 IN_PROC_BROWSER_TEST_F(WebViewTest
, Dialog_TestAlertDialog
) {
2162 TestHelper("testAlertDialog", "web_view/dialog", NO_TEST_SERVER
);
2165 IN_PROC_BROWSER_TEST_F(WebViewTest
, TestConfirmDialog
) {
2166 TestHelper("testConfirmDialog", "web_view/dialog", NO_TEST_SERVER
);
2169 IN_PROC_BROWSER_TEST_F(WebViewTest
, Dialog_TestConfirmDialogCancel
) {
2170 TestHelper("testConfirmDialogCancel", "web_view/dialog", NO_TEST_SERVER
);
2173 IN_PROC_BROWSER_TEST_F(WebViewTest
, Dialog_TestConfirmDialogDefaultCancel
) {
2174 TestHelper("testConfirmDialogDefaultCancel",
2179 IN_PROC_BROWSER_TEST_F(WebViewTest
, Dialog_TestConfirmDialogDefaultGCCancel
) {
2180 TestHelper("testConfirmDialogDefaultGCCancel",
2185 IN_PROC_BROWSER_TEST_F(WebViewTest
, Dialog_TestPromptDialog
) {
2186 TestHelper("testPromptDialog", "web_view/dialog", NO_TEST_SERVER
);
2189 IN_PROC_BROWSER_TEST_F(WebViewTest
, NoContentSettingsAPI
) {
2190 // Load the extension.
2191 const extensions::Extension
* content_settings_extension
=
2193 test_data_dir_
.AppendASCII(
2194 "platform_apps/web_view/extension_api/content_settings"));
2195 ASSERT_TRUE(content_settings_extension
);
2196 TestHelper("testPostMessageCommChannel", "web_view/shim", NO_TEST_SERVER
);
2199 #if defined(ENABLE_PLUGINS)
2200 class WebViewPluginTest
: public WebViewTest
{
2202 virtual void SetUpCommandLine(CommandLine
* command_line
) OVERRIDE
{
2203 WebViewTest::SetUpCommandLine(command_line
);
2205 // Append the switch to register the pepper plugin.
2206 // library name = <out dir>/<test_name>.<library_extension>
2207 // MIME type = application/x-ppapi-<test_name>
2208 base::FilePath plugin_dir
;
2209 EXPECT_TRUE(PathService::Get(base::DIR_MODULE
, &plugin_dir
));
2211 base::FilePath plugin_lib
= plugin_dir
.Append(library_name
);
2212 EXPECT_TRUE(base::PathExists(plugin_lib
));
2213 base::FilePath::StringType pepper_plugin
= plugin_lib
.value();
2214 pepper_plugin
.append(FILE_PATH_LITERAL(";application/x-ppapi-tests"));
2215 command_line
->AppendSwitchNative(switches::kRegisterPepperPlugins
,
2220 IN_PROC_BROWSER_TEST_F(WebViewPluginTest
, TestLoadPluginEvent
) {
2221 TestHelper("testPluginLoadPermission", "web_view/shim", NO_TEST_SERVER
);
2223 #endif // defined(ENABLE_PLUGINS)
2225 class WebViewCaptureTest
: public WebViewTest
{
2227 WebViewCaptureTest() {}
2228 virtual ~WebViewCaptureTest() {}
2229 virtual void SetUp() OVERRIDE
{
2230 EnablePixelOutput();
2231 WebViewTest::SetUp();
2235 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestZoomAPI
) {
2236 TestHelper("testZoomAPI", "web_view/shim", NO_TEST_SERVER
);
2239 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestFindAPI
) {
2240 TestHelper("testFindAPI", "web_view/shim", NO_TEST_SERVER
);
2243 IN_PROC_BROWSER_TEST_F(WebViewTest
, Shim_TestFindAPI_findupdate
) {
2244 TestHelper("testFindAPI_findupdate", "web_view/shim", NO_TEST_SERVER
);
2247 // <webview> screenshot capture fails with ubercomp.
2248 // See http://crbug.com/327035.
2249 IN_PROC_BROWSER_TEST_F(WebViewCaptureTest
,
2250 DISABLED_Shim_ScreenshotCapture
) {
2251 TestHelper("testScreenshotCapture", "web_view/shim", NO_TEST_SERVER
);