1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/path_service.h"
6 #include "content/browser/gpu/gpu_data_manager_impl.h"
7 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
8 #include "content/public/browser/notification_service.h"
9 #include "content/public/browser/notification_types.h"
10 #include "content/public/common/content_paths.h"
11 #include "content/public/test/browser_test_utils.h"
12 #include "content/public/test/test_utils.h"
13 #include "content/shell/shell.h"
14 #include "content/test/content_browser_test.h"
15 #include "content/test/content_browser_test_utils.h"
18 class GpuCrashTest
: public ContentBrowserTest
{
20 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE
{
21 base::FilePath test_dir
;
22 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA
, &test_dir
));
23 gpu_test_dir_
= test_dir
.AppendASCII("gpu");
25 base::FilePath gpu_test_dir_
;
28 IN_PROC_BROWSER_TEST_F(GpuCrashTest
, MANUAL_Kill
) {
29 DOMMessageQueue message_queue
;
31 content::GpuDataManagerImpl::GetInstance()->
32 DisableDomainBlockingFor3DAPIsForTesting();
34 // Load page and wait for it to load.
35 content::WindowedNotificationObserver
observer(
36 content::NOTIFICATION_LOAD_STOP
,
37 content::NotificationService::AllSources());
41 gpu_test_dir_
.AppendASCII("webgl.html"), "query=kill"));
44 GpuProcessHostUIShim
* host
=
45 GpuProcessHostUIShim::GetOneInstance();
47 host
->SimulateCrash();
50 ASSERT_TRUE(message_queue
.WaitForMessage(&m
));
51 EXPECT_EQ("\"SUCCESS\"", m
);
54 IN_PROC_BROWSER_TEST_F(GpuCrashTest
, MANUAL_WebkitLoseContext
) {
55 DOMMessageQueue message_queue
;
60 gpu_test_dir_
.AppendASCII("webgl.html"),
61 "query=WEBGL_lose_context"));
64 ASSERT_TRUE(message_queue
.WaitForMessage(&m
));
65 EXPECT_EQ("\"SUCCESS\"", m
);
68 } // namespace content