| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "base/path_service.h" | 5 #include "base/path_service.h" |
| 6 #include "content/browser/gpu/gpu_data_manager_impl.h" | 6 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 7 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 7 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 8 #include "content/public/browser/notification_service.h" | 8 #include "content/public/browser/notification_service.h" |
| 9 #include "content/public/browser/notification_types.h" | 9 #include "content/public/browser/notification_types.h" |
| 10 #include "content/public/common/content_paths.h" | 10 #include "content/public/common/content_paths.h" |
| 11 #include "content/public/test/browser_test_utils.h" | 11 #include "content/public/test/browser_test_utils.h" |
| 12 #include "content/public/test/test_utils.h" | 12 #include "content/public/test/test_utils.h" |
| 13 #include "content/shell/shell.h" | 13 #include "content/shell/shell.h" |
| 14 #include "content/test/content_browser_test.h" | 14 #include "content/test/content_browser_test.h" |
| 15 #include "content/test/content_browser_test_utils.h" | 15 #include "content/test/content_browser_test_utils.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 class GpuCrashTest : public ContentBrowserTest { | 18 class GpuCrashTest : public ContentBrowserTest { |
| 19 protected: | 19 protected: |
| 20 virtual void SetUpInProcessBrowserTestFixture() { | 20 virtual void SetUpInProcessBrowserTestFixture() { |
| 21 FilePath test_dir; | 21 FilePath test_dir; |
| 22 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &test_dir)); | 22 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &test_dir)); |
| 23 gpu_test_dir_ = test_dir.AppendASCII("gpu"); | 23 gpu_test_dir_ = test_dir.AppendASCII("gpu"); |
| 24 } | 24 } |
| 25 FilePath gpu_test_dir_; | 25 FilePath gpu_test_dir_; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 IN_PROC_BROWSER_TEST_F(GpuCrashTest, MANUAL_Kill) { | 28 IN_PROC_BROWSER_TEST_F(GpuCrashTest, MANUAL_Kill) { |
| 29 #if defined(OS_MACOSX) | |
| 30 // crbug.com/173456 | |
| 31 return; | |
| 32 #endif | |
| 33 | |
| 34 DOMMessageQueue message_queue; | 29 DOMMessageQueue message_queue; |
| 35 | 30 |
| 36 content::GpuDataManagerImpl::GetInstance()-> | 31 content::GpuDataManagerImpl::GetInstance()-> |
| 37 DisableDomainBlockingFor3DAPIsForTesting(); | 32 DisableDomainBlockingFor3DAPIsForTesting(); |
| 38 | 33 |
| 39 // Load page and wait for it to load. | 34 // Load page and wait for it to load. |
| 40 content::WindowedNotificationObserver observer( | 35 content::WindowedNotificationObserver observer( |
| 41 content::NOTIFICATION_LOAD_STOP, | 36 content::NOTIFICATION_LOAD_STOP, |
| 42 content::NotificationService::AllSources()); | 37 content::NotificationService::AllSources()); |
| 43 NavigateToURL( | 38 NavigateToURL( |
| 44 shell(), | 39 shell(), |
| 45 GetFileUrlWithQuery( | 40 GetFileUrlWithQuery( |
| 46 gpu_test_dir_.AppendASCII("webgl.html"), "query=kill")); | 41 gpu_test_dir_.AppendASCII("webgl.html"), "query=kill")); |
| 47 observer.Wait(); | 42 observer.Wait(); |
| 48 | 43 |
| 49 GpuProcessHostUIShim* host = | 44 GpuProcessHostUIShim* host = |
| 50 GpuProcessHostUIShim::GetOneInstance(); | 45 GpuProcessHostUIShim::GetOneInstance(); |
| 51 ASSERT_TRUE(host); | 46 ASSERT_TRUE(host); |
| 52 host->SimulateCrash(); | 47 host->SimulateCrash(); |
| 53 | 48 |
| 54 std::string m; | 49 std::string m; |
| 55 ASSERT_TRUE(message_queue.WaitForMessage(&m)); | 50 ASSERT_TRUE(message_queue.WaitForMessage(&m)); |
| 56 EXPECT_EQ("\"SUCCESS\"", m); | 51 EXPECT_EQ("\"SUCCESS\"", m); |
| 57 } | 52 } |
| 58 | 53 |
| 59 IN_PROC_BROWSER_TEST_F(GpuCrashTest, MANUAL_WebkitLoseContext) { | 54 IN_PROC_BROWSER_TEST_F(GpuCrashTest, MANUAL_WebkitLoseContext) { |
| 60 #if defined(OS_MACOSX) | |
| 61 // crbug.com/173456 | |
| 62 return; | |
| 63 #endif | |
| 64 | |
| 65 DOMMessageQueue message_queue; | 55 DOMMessageQueue message_queue; |
| 66 | 56 |
| 67 NavigateToURL( | 57 NavigateToURL( |
| 68 shell(), | 58 shell(), |
| 69 GetFileUrlWithQuery( | 59 GetFileUrlWithQuery( |
| 70 gpu_test_dir_.AppendASCII("webgl.html"), | 60 gpu_test_dir_.AppendASCII("webgl.html"), |
| 71 "query=WEBGL_lose_context")); | 61 "query=WEBGL_lose_context")); |
| 72 | 62 |
| 73 std::string m; | 63 std::string m; |
| 74 ASSERT_TRUE(message_queue.WaitForMessage(&m)); | 64 ASSERT_TRUE(message_queue.WaitForMessage(&m)); |
| 75 EXPECT_EQ("\"SUCCESS\"", m); | 65 EXPECT_EQ("\"SUCCESS\"", m); |
| 76 } | 66 } |
| 77 | 67 |
| 78 } // namespace content | 68 } // namespace content |
| OLD | NEW |