Chromium Code Reviews
Help | Chromium Project | Sign in
(815)

Side by Side Diff: content/browser/gpu/gpu_crash_browsertest.cc

Issue 10984040: Enable gpu crash tests in content (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add TODO Created 1 year, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/gpu/gpu_crash_browsertest.cc ('k') | content/content_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // TODO(yongsheng): do the similar thing like chrome::SelectPreviousTab
26 ui_test_utils::BROWSER_TEST_NONE); 24 // for shells
jam 2012/10/24 20:13:05 why? what does this give us? i.e. I'm not sure why
27 chrome::SelectPreviousTab(browser); 25 LOG(ERROR) << "SimulateGPUCrash, after LoadURL";
28 LOG(ERROR) << "SimulateGPUCrash, after CloseTab";
29 } 26 }
30 27
31 } // namespace 28 } // namespace
32 29
33 class GPUCrashTest : public InProcessBrowserTest { 30 namespace content {
31 class GPUCrashTest : public ContentBrowserTest {
34 protected: 32 protected:
35 virtual void SetUpCommandLine(CommandLine* command_line) { 33 virtual void SetUpCommandLine(CommandLine* command_line) {
36 // GPU tests require gpu acceleration. 34 // GPU tests require gpu acceleration.
37 // We do not care which GL backend is used. 35 // We do not care which GL backend is used.
38 command_line->AppendSwitchASCII(switches::kUseGL, "any"); 36 command_line->AppendSwitchASCII(switches::kUseGL, "any");
39 } 37 }
40 virtual void SetUpInProcessBrowserTestFixture() { 38 virtual void SetUpInProcessBrowserTestFixture() {
41 FilePath test_dir; 39 FilePath test_dir;
42 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); 40 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &test_dir));
43 gpu_test_dir_ = test_dir.AppendASCII("gpu"); 41 gpu_test_dir_ = test_dir.AppendASCII("gpu");
44 } 42 }
45 FilePath gpu_test_dir_; 43 FilePath gpu_test_dir_;
46 }; 44 };
47 45
48 // Currently Kill times out on GPU bots: http://crbug.com/101513 46 // Currently Kill times out on GPU bots: http://crbug.com/101513
49 IN_PROC_BROWSER_TEST_F(GPUCrashTest, DISABLED_Kill) { 47 IN_PROC_BROWSER_TEST_F(GPUCrashTest, MANUAL_Kill) {
50 content::DOMMessageQueue message_queue; 48 DOMMessageQueue message_queue;
51 49
52 ui_test_utils::NavigateToURL( 50 NavigateToURL(
53 browser(), 51 shell(),
54 content::GetFileUrlWithQuery( 52 GetFileUrlWithQuery(
55 gpu_test_dir_.AppendASCII("webgl.html"), "query=kill")); 53 gpu_test_dir_.AppendASCII("webgl.html"), "query=kill"));
56 SimulateGPUCrash(browser()); 54 scoped_ptr<Shell> shell(CreateBrowser());
55 SimulateGPUCrash(shell.get());
57 56
58 std::string m; 57 std::string m;
59 ASSERT_TRUE(message_queue.WaitForMessage(&m)); 58 ASSERT_TRUE(message_queue.WaitForMessage(&m));
60 EXPECT_EQ("\"SUCCESS\"", m); 59 EXPECT_EQ("\"SUCCESS\"", m);
61 } 60 }
62 61
63 62
64 IN_PROC_BROWSER_TEST_F(GPUCrashTest, WebkitLoseContext) { 63 IN_PROC_BROWSER_TEST_F(GPUCrashTest, MANUAL_WebkitLoseContext) {
65 content::DOMMessageQueue message_queue; 64 DOMMessageQueue message_queue;
66 65
67 ui_test_utils::NavigateToURL( 66 NavigateToURL(
68 browser(), 67 shell(),
69 content::GetFileUrlWithQuery( 68 GetFileUrlWithQuery(
70 gpu_test_dir_.AppendASCII("webgl.html"), 69 gpu_test_dir_.AppendASCII("webgl.html"),
71 "query=WEBGL_lose_context")); 70 "query=WEBGL_lose_context"));
72 71
73 std::string m; 72 std::string m;
74 ASSERT_TRUE(message_queue.WaitForMessage(&m)); 73 ASSERT_TRUE(message_queue.WaitForMessage(&m));
75 EXPECT_EQ("\"SUCCESS\"", m); 74 EXPECT_EQ("\"SUCCESS\"", m);
76 } 75 }
76
77 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/gpu/gpu_crash_browsertest.cc ('k') | content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1275:d14800f88434