OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/zoom/zoom_controller.h" | 5 #include "chrome/browser/ui/zoom/zoom_controller.h" |
6 | 6 |
7 #include "base/process/kill.h" | 7 #include "base/process/kill.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
11 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
12 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
| 13 #include "content/public/browser/render_view_host.h" |
13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
14 #include "content/public/test/browser_test_utils.h" | 15 #include "content/public/test/browser_test_utils.h" |
15 | 16 |
16 typedef InProcessBrowserTest ZoomControllerBrowserTest; | 17 typedef InProcessBrowserTest ZoomControllerBrowserTest; |
17 | 18 |
18 // TODO(wjmaclean): Enable this on Android when we can kill the process there. | 19 // TODO(wjmaclean): Enable this on Android when we can kill the process there. |
19 #if defined(OS_ANDROID) | 20 #if defined(OS_ANDROID) |
20 #define MAYBE_CrashedTabsDoNotChangeZoom DISABLED_CrashedTabsDoNotChangeZoom | 21 #define MAYBE_CrashedTabsDoNotChangeZoom DISABLED_CrashedTabsDoNotChangeZoom |
21 #else | 22 #else |
22 #define MAYBE_CrashedTabsDoNotChangeZoom CrashedTabsDoNotChangeZoom | 23 #define MAYBE_CrashedTabsDoNotChangeZoom CrashedTabsDoNotChangeZoom |
(...skipping 10 matching lines...) Expand all Loading... |
33 double old_zoom_level = zoom_controller->GetZoomLevel(); | 34 double old_zoom_level = zoom_controller->GetZoomLevel(); |
34 double new_zoom_level = old_zoom_level + 0.5; | 35 double new_zoom_level = old_zoom_level + 0.5; |
35 | 36 |
36 content::RenderProcessHost* host = web_contents->GetRenderProcessHost(); | 37 content::RenderProcessHost* host = web_contents->GetRenderProcessHost(); |
37 { | 38 { |
38 content::RenderProcessHostWatcher crash_observer( | 39 content::RenderProcessHostWatcher crash_observer( |
39 host, content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 40 host, content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
40 base::KillProcess(host->GetHandle(), 0, false); | 41 base::KillProcess(host->GetHandle(), 0, false); |
41 crash_observer.Wait(); | 42 crash_observer.Wait(); |
42 } | 43 } |
43 EXPECT_FALSE(web_contents->GetRenderProcessHost()->HasConnection()); | 44 EXPECT_FALSE(web_contents->GetRenderViewHost()->IsRenderViewLive()); |
44 | 45 |
45 // The following attempt to change the zoom level for a crashed tab should | 46 // The following attempt to change the zoom level for a crashed tab should |
46 // fail. | 47 // fail. |
47 zoom_controller->SetZoomLevel(new_zoom_level); | 48 zoom_controller->SetZoomLevel(new_zoom_level); |
48 EXPECT_FLOAT_EQ(old_zoom_level, zoom_controller->GetZoomLevel()); | 49 EXPECT_FLOAT_EQ(old_zoom_level, zoom_controller->GetZoomLevel()); |
49 } | 50 } |
OLD | NEW |