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/memory/scoped_ptr.h" | |
6 #include "base/path_service.h" | 7 #include "base/path_service.h" |
7 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/ui/browser.h" | 9 #include "content/public/common/content_paths.h" |
9 #include "chrome/browser/ui/browser_commands.h" | 10 #include "content/public/common/url_constants.h" |
10 #include "chrome/common/chrome_paths.h" | |
11 #include "chrome/common/chrome_switches.h" | |
12 #include "chrome/common/url_constants.h" | |
13 #include "chrome/test/base/in_process_browser_test.h" | |
14 #include "chrome/test/base/test_launcher_utils.h" | |
15 #include "chrome/test/base/ui_test_utils.h" | |
16 #include "content/public/test/browser_test_utils.h" | 11 #include "content/public/test/browser_test_utils.h" |
12 #include "content/shell/shell.h" | |
13 #include "content/test/content_browser_test.h" | |
14 #include "content/test/content_browser_test_utils.h" | |
17 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "ui/gl/gl_implementation.h" | 16 #include "ui/gl/gl_implementation.h" |
19 | 17 |
20 namespace { | 18 namespace { |
21 | 19 |
22 void SimulateGPUCrash(Browser* browser) { | 20 void SimulateGPUCrash(content::Shell* s) { |
23 LOG(ERROR) << "SimulateGPUCrash, before NavigateToURLWithDisposition"; | 21 LOG(ERROR) << "SimulateGPUCrash, before LoadURL"; |
24 ui_test_utils::NavigateToURLWithDisposition(browser, | 22 s->LoadURL(GURL(chrome::kChromeUIGpuCrashURL)); |
25 GURL(chrome::kChromeUIGpuCrashURL), NEW_FOREGROUND_TAB, | 23 LOG(ERROR) << "SimulateGPUCrash, after LoadURL"; |
26 ui_test_utils::BROWSER_TEST_NONE); | |
27 chrome::SelectPreviousTab(browser); | |
Zhenyao Mo
2012/10/22 22:54:33
This behavior is lost in the new test. Is there a
yongsheng
2012/10/23 05:51:42
there is no function in shell to activate one.
Fro
jam
2012/10/24 20:13:04
what does the SelectPreviousTab call give us?
| |
28 LOG(ERROR) << "SimulateGPUCrash, after CloseTab"; | |
29 } | 24 } |
30 | 25 |
31 } // namespace | 26 } // namespace |
32 | 27 |
33 class GPUCrashTest : public InProcessBrowserTest { | 28 namespace content { |
29 class GPUCrashTest : public ContentBrowserTest { | |
34 protected: | 30 protected: |
35 virtual void SetUpCommandLine(CommandLine* command_line) { | 31 virtual void SetUpCommandLine(CommandLine* command_line) { |
36 // GPU tests require gpu acceleration. | 32 // GPU tests require gpu acceleration. |
37 // We do not care which GL backend is used. | 33 // We do not care which GL backend is used. |
38 command_line->AppendSwitchASCII(switches::kUseGL, "any"); | 34 command_line->AppendSwitchASCII(switches::kUseGL, "any"); |
39 } | 35 } |
40 virtual void SetUpInProcessBrowserTestFixture() { | 36 virtual void SetUpInProcessBrowserTestFixture() { |
41 FilePath test_dir; | 37 FilePath test_dir; |
42 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); | 38 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &test_dir)); |
43 gpu_test_dir_ = test_dir.AppendASCII("gpu"); | 39 gpu_test_dir_ = test_dir.AppendASCII("gpu"); |
44 } | 40 } |
45 FilePath gpu_test_dir_; | 41 FilePath gpu_test_dir_; |
46 }; | 42 }; |
47 | 43 |
48 // Currently Kill times out on GPU bots: http://crbug.com/101513 | 44 // Currently Kill times out on GPU bots: http://crbug.com/101513 |
49 IN_PROC_BROWSER_TEST_F(GPUCrashTest, DISABLED_Kill) { | 45 IN_PROC_BROWSER_TEST_F(GPUCrashTest, MANUAL_DISABLED_Kill) { |
Zhenyao Mo
2012/10/22 22:54:33
Remove DISABLED_
yongsheng
2012/10/23 05:51:42
done.
| |
50 content::DOMMessageQueue message_queue; | 46 DOMMessageQueue message_queue; |
51 | 47 |
52 ui_test_utils::NavigateToURL( | 48 NavigateToURL( |
53 browser(), | 49 shell(), |
54 content::GetFileUrlWithQuery( | 50 GetFileUrlWithQuery( |
55 gpu_test_dir_.AppendASCII("webgl.html"), "query=kill")); | 51 gpu_test_dir_.AppendASCII("webgl.html"), "query=kill")); |
56 SimulateGPUCrash(browser()); | 52 scoped_ptr<Shell> shell(CreateBrowser()); |
53 SimulateGPUCrash(shell.get()); | |
57 | 54 |
58 std::string m; | 55 std::string m; |
59 ASSERT_TRUE(message_queue.WaitForMessage(&m)); | 56 ASSERT_TRUE(message_queue.WaitForMessage(&m)); |
60 EXPECT_EQ("\"SUCCESS\"", m); | 57 EXPECT_EQ("\"SUCCESS\"", m); |
61 } | 58 } |
62 | 59 |
63 | 60 |
64 IN_PROC_BROWSER_TEST_F(GPUCrashTest, WebkitLoseContext) { | 61 IN_PROC_BROWSER_TEST_F(GPUCrashTest, MANUAL_WebkitLoseContext) { |
65 content::DOMMessageQueue message_queue; | 62 DOMMessageQueue message_queue; |
66 | 63 |
67 ui_test_utils::NavigateToURL( | 64 NavigateToURL( |
68 browser(), | 65 shell(), |
69 content::GetFileUrlWithQuery( | 66 GetFileUrlWithQuery( |
70 gpu_test_dir_.AppendASCII("webgl.html"), | 67 gpu_test_dir_.AppendASCII("webgl.html"), |
71 "query=WEBGL_lose_context")); | 68 "query=WEBGL_lose_context")); |
72 | 69 |
73 std::string m; | 70 std::string m; |
74 ASSERT_TRUE(message_queue.WaitForMessage(&m)); | 71 ASSERT_TRUE(message_queue.WaitForMessage(&m)); |
75 EXPECT_EQ("\"SUCCESS\"", m); | 72 EXPECT_EQ("\"SUCCESS\"", m); |
76 } | 73 } |
74 | |
75 } // namespace content | |
OLD | NEW |