Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(696)

Side by Side Diff: chrome/browser/apps/web_view_browsertest.cc

Issue 26277010: Create content::WebContentsDestroyedWatcher, use it in many tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "apps/native_app_window.h" 5 #include "apps/native_app_window.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/apps/app_browsertest_util.h" 9 #include "chrome/browser/apps/app_browsertest_util.h"
10 #include "chrome/browser/automation/automation_util.h" 10 #include "chrome/browser/automation/automation_util.h"
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 embedder_web_contents, 951 embedder_web_contents,
952 "runTest('testRemoveWebviewOnExit')")); 952 "runTest('testRemoveWebviewOnExit')"));
953 guest_observer.Wait(); 953 guest_observer.Wait();
954 954
955 content::Source<content::NavigationController> source = 955 content::Source<content::NavigationController> source =
956 guest_observer.source(); 956 guest_observer.source();
957 EXPECT_TRUE(source->GetWebContents()->GetRenderProcessHost()->IsGuest()); 957 EXPECT_TRUE(source->GetWebContents()->GetRenderProcessHost()->IsGuest());
958 958
959 ASSERT_TRUE(guest_loaded_listener.WaitUntilSatisfied()); 959 ASSERT_TRUE(guest_loaded_listener.WaitUntilSatisfied());
960 960
961 content::WindowedNotificationObserver observer( 961 content::WebContentsDestroyedWatcher destroyed_watcher(
962 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 962 source->GetWebContents());
963 content::Source<content::WebContents>(source->GetWebContents()));
964 963
965 // Tell the embedder to kill the guest. 964 // Tell the embedder to kill the guest.
966 EXPECT_TRUE(content::ExecuteScript( 965 EXPECT_TRUE(content::ExecuteScript(
967 embedder_web_contents, 966 embedder_web_contents,
968 "removeWebviewOnExitDoCrash();")); 967 "removeWebviewOnExitDoCrash();"));
969 968
970 // Wait until the guest WebContents is destroyed. 969 // Wait until the guest WebContents is destroyed.
971 observer.Wait(); 970 destroyed_watcher.Wait();
972 } 971 }
973 972
974 // Remove <webview> immediately after navigating it. 973 // Remove <webview> immediately after navigating it.
975 // This is a regression test for http://crbug.com/276023. 974 // This is a regression test for http://crbug.com/276023.
976 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveWebviewAfterNavigation) { 975 IN_PROC_BROWSER_TEST_F(WebViewTest, Shim_TestRemoveWebviewAfterNavigation) {
977 TestHelper("testRemoveWebviewAfterNavigation", 976 TestHelper("testRemoveWebviewAfterNavigation",
978 "DoneShimTest.PASSED", 977 "DoneShimTest.PASSED",
979 "DoneShimTest.FAILED", 978 "DoneShimTest.FAILED",
980 "web_view/shim"); 979 "web_view/shim");
981 } 980 }
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 } 1855 }
1857 }; 1856 };
1858 1857
1859 IN_PROC_BROWSER_TEST_F(WebViewPluginTest, TestLoadPluginEvent) { 1858 IN_PROC_BROWSER_TEST_F(WebViewPluginTest, TestLoadPluginEvent) {
1860 TestHelper("testPluginLoadPermission", 1859 TestHelper("testPluginLoadPermission",
1861 "DoneShimTest.PASSED", 1860 "DoneShimTest.PASSED",
1862 "DoneShimTest.FAILED", 1861 "DoneShimTest.FAILED",
1863 "web_view/shim"); 1862 "web_view/shim");
1864 } 1863 }
1865 #endif // defined(ENABLE_PLUGINS) 1864 #endif // defined(ENABLE_PLUGINS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698