Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

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: no new files Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
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 // SimulateGPUCrash owns the passed 'shell', this should be
jam 2012/10/01 16:10:47 this comment is confusing, what do you mean by own
yongsheng 2012/10/11 02:08:47 this's obselete. i'll remove it.
23 LOG(ERROR) << "SimulateGPUCrash, before NavigateToURLWithDisposition"; 21 // other than the main one
24 ui_test_utils::NavigateToURLWithDisposition(browser, 22 void SimulateGPUCrash(content::Shell* s) {
25 GURL(chrome::kChromeUIGpuCrashURL), NEW_FOREGROUND_TAB, 23 LOG(ERROR) << "SimulateGPUCrash, before NavigateToURL";
26 ui_test_utils::BROWSER_TEST_NONE); 24 s->LoadURL(GURL(chrome::kChromeUIGpuCrashURL));
27 chrome::SelectPreviousTab(browser); 25 LOG(ERROR) << "SimulateGPUCrash, after NavigateToURL";
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_DISABLED_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());
jam 2012/10/01 16:10:47 the test used to kill the browser window that had
yongsheng 2012/10/11 02:08:47 the scenario is that previously browser in chrome
jam 2012/10/17 15:17:15 I'm not following what you're saying. Yes in brows
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
This is Rietveld 408576698