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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
13 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
14 #include "chrome/test/base/test_launcher_utils.h" | 14 #include "chrome/test/base/test_launcher_utils.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
| 16 #include "content/public/common/content_paths.h" |
16 #include "content/public/test/browser_test_utils.h" | 17 #include "content/public/test/browser_test_utils.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "ui/gl/gl_implementation.h" | 19 #include "ui/gl/gl_implementation.h" |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 void SimulateGPUCrash(Browser* browser) { | 23 void SimulateGPUCrash(Browser* browser) { |
23 LOG(ERROR) << "SimulateGPUCrash, before NavigateToURLWithDisposition"; | 24 LOG(ERROR) << "SimulateGPUCrash, before NavigateToURLWithDisposition"; |
24 ui_test_utils::NavigateToURLWithDisposition(browser, | 25 ui_test_utils::NavigateToURLWithDisposition(browser, |
25 GURL(chrome::kChromeUIGpuCrashURL), NEW_FOREGROUND_TAB, | 26 GURL(chrome::kChromeUIGpuCrashURL), NEW_FOREGROUND_TAB, |
26 ui_test_utils::BROWSER_TEST_NONE); | 27 ui_test_utils::BROWSER_TEST_NONE); |
27 chrome::SelectPreviousTab(browser); | 28 chrome::SelectPreviousTab(browser); |
28 LOG(ERROR) << "SimulateGPUCrash, after CloseTab"; | 29 LOG(ERROR) << "SimulateGPUCrash, after CloseTab"; |
29 } | 30 } |
30 | 31 |
31 } // namespace | 32 } // namespace |
32 | 33 |
33 class GPUCrashTest : public InProcessBrowserTest { | 34 class GPUCrashTest : public InProcessBrowserTest { |
34 protected: | 35 protected: |
35 virtual void SetUpCommandLine(CommandLine* command_line) { | 36 virtual void SetUpCommandLine(CommandLine* command_line) { |
36 // GPU tests require gpu acceleration. | 37 // GPU tests require gpu acceleration. |
37 // We do not care which GL backend is used. | 38 // We do not care which GL backend is used. |
38 command_line->AppendSwitchASCII(switches::kUseGL, "any"); | 39 command_line->AppendSwitchASCII(switches::kUseGL, "any"); |
39 } | 40 } |
40 virtual void SetUpInProcessBrowserTestFixture() { | 41 virtual void SetUpInProcessBrowserTestFixture() { |
41 FilePath test_dir; | 42 FilePath test_dir; |
42 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); | 43 ASSERT_TRUE(PathService::Get(content::DIR_TEST_DATA, &test_dir)); |
43 gpu_test_dir_ = test_dir.AppendASCII("gpu"); | 44 gpu_test_dir_ = test_dir.AppendASCII("gpu"); |
44 } | 45 } |
45 FilePath gpu_test_dir_; | 46 FilePath gpu_test_dir_; |
46 }; | 47 }; |
47 | 48 |
48 // Currently Kill times out on GPU bots: http://crbug.com/101513 | 49 // Currently Kill times out on GPU bots: http://crbug.com/101513 |
49 IN_PROC_BROWSER_TEST_F(GPUCrashTest, DISABLED_Kill) { | 50 IN_PROC_BROWSER_TEST_F(GPUCrashTest, DISABLED_Kill) { |
50 content::DOMMessageQueue message_queue; | 51 content::DOMMessageQueue message_queue; |
51 | 52 |
52 ui_test_utils::NavigateToURL( | 53 ui_test_utils::NavigateToURL( |
(...skipping 14 matching lines...) Expand all Loading... |
67 ui_test_utils::NavigateToURL( | 68 ui_test_utils::NavigateToURL( |
68 browser(), | 69 browser(), |
69 content::GetFileUrlWithQuery( | 70 content::GetFileUrlWithQuery( |
70 gpu_test_dir_.AppendASCII("webgl.html"), | 71 gpu_test_dir_.AppendASCII("webgl.html"), |
71 "query=WEBGL_lose_context")); | 72 "query=WEBGL_lose_context")); |
72 | 73 |
73 std::string m; | 74 std::string m; |
74 ASSERT_TRUE(message_queue.WaitForMessage(&m)); | 75 ASSERT_TRUE(message_queue.WaitForMessage(&m)); |
75 EXPECT_EQ("\"SUCCESS\"", m); | 76 EXPECT_EQ("\"SUCCESS\"", m); |
76 } | 77 } |
OLD | NEW |