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

Side by Side Diff: chrome/test/gpu/gpu_crash_browsertest.cc

Issue 11783078: Remove certain gpu crash tests from gpu_tests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 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/chrome_tests.gypi ('k') | chrome/test/gpu/webgl_infobar_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "base/command_line.h"
6 #include "base/path_service.h"
7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h"
9 #include "chrome/browser/api/infobars/infobar_service.h"
10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_commands.h"
12 #include "chrome/browser/ui/browser_navigator.h"
13 #include "chrome/browser/ui/browser_tabstrip.h"
14 #include "chrome/common/chrome_notification_types.h"
15 #include "chrome/common/chrome_paths.h"
16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/url_constants.h"
18 #include "chrome/test/base/in_process_browser_test.h"
19 #include "chrome/test/base/test_launcher_utils.h"
20 #include "chrome/test/base/ui_test_utils.h"
21 #include "content/public/browser/gpu_data_manager.h"
22 #include "content/public/browser/notification_service.h"
23 #include "content/public/browser/notification_types.h"
24 #include "content/public/common/content_paths.h"
25 #include "content/public/common/page_transition_types.h"
26 #include "content/public/test/browser_test_utils.h"
27 #include "content/test/gpu/gpu_test_config.h"
28 #include "testing/gtest/include/gtest/gtest.h"
29 #include "ui/gl/gl_implementation.h"
30
31 namespace {
32
33 void SimulateGPUCrash(Browser* browser) {
34 // None of the ui_test_utils entry points supports what we need to
35 // do here: navigate with the PAGE_TRANSITION_FROM_ADDRESS_BAR flag,
36 // without waiting for the navigation. It would be painful to change
37 // either of the NavigateToURL entry points to support these two
38 // constraints, so we use chrome::Navigate directly.
39 chrome::NavigateParams params(
40 browser,
41 GURL(chrome::kChromeUIGpuCrashURL),
42 static_cast<content::PageTransition>(
43 content::PAGE_TRANSITION_TYPED |
44 content::PAGE_TRANSITION_FROM_ADDRESS_BAR));
45 params.disposition = NEW_BACKGROUND_TAB;
46 chrome::Navigate(&params);
47 }
48
49 } // namespace
50
51 class GPUCrashTest : public InProcessBrowserTest {
52 protected:
53 virtual void SetUpCommandLine(CommandLine* command_line) {
54 // GPU tests require gpu acceleration.
55 // We do not care which GL backend is used.
56 command_line->AppendSwitchASCII(switches::kUseGL, "any");
57 }
58 virtual void SetUpInProcessBrowserTestFixture() {
59 FilePath test_dir;
60 ASSERT_TRUE(PathService::Get(content::DIR_TEST_DATA, &test_dir));
61 gpu_test_dir_ = test_dir.AppendASCII("gpu");
62 }
63 FilePath gpu_test_dir_;
64 };
65
66 IN_PROC_BROWSER_TEST_F(GPUCrashTest, Kill) {
67 // crbug.com/162982, flaky on Mac Retina Release.
68 if (GPUTestBotConfig::CurrentConfigMatches("MAC NVIDIA 0x0fd5 RELEASE"))
69 return;
70
71 content::DOMMessageQueue message_queue;
72
73 content::GpuDataManager::GetInstance()->
74 DisableDomainBlockingFor3DAPIsForTesting();
75
76 // Load page and wait for it to load.
77 content::WindowedNotificationObserver observer(
78 content::NOTIFICATION_LOAD_STOP,
79 content::NotificationService::AllSources());
80 ui_test_utils::NavigateToURL(
81 browser(),
82 content::GetFileUrlWithQuery(
83 gpu_test_dir_.AppendASCII("webgl.html"), "query=kill"));
84 observer.Wait();
85
86 SimulateGPUCrash(browser());
87
88 std::string m;
89 ASSERT_TRUE(message_queue.WaitForMessage(&m));
90 EXPECT_EQ("\"SUCCESS\"", m);
91 }
92
93 IN_PROC_BROWSER_TEST_F(GPUCrashTest, ContextLossRaisesInfobar) {
94 // crbug.com/162982, flaky on Mac Retina Release.
95 if (GPUTestBotConfig::CurrentConfigMatches("MAC NVIDIA 0x0fd5 RELEASE"))
96 return;
97
98 // Load page and wait for it to load.
99 content::WindowedNotificationObserver observer(
100 content::NOTIFICATION_LOAD_STOP,
101 content::NotificationService::AllSources());
102 ui_test_utils::NavigateToURL(
103 browser(),
104 content::GetFileUrlWithQuery(
105 gpu_test_dir_.AppendASCII("webgl.html"), "query=kill"));
106 observer.Wait();
107
108 content::WindowedNotificationObserver infobar_added(
109 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
110 content::NotificationService::AllSources());
111 SimulateGPUCrash(browser());
112 infobar_added.Wait();
113 EXPECT_EQ(1u,
114 InfoBarService::FromWebContents(
115 chrome::GetActiveWebContents(browser()))->GetInfoBarCount());
116 }
117
118 IN_PROC_BROWSER_TEST_F(GPUCrashTest, ContextLossInfobarReload) {
119 // crbug.com/162982, flaky on Mac Retina Release.
120 if (GPUTestBotConfig::CurrentConfigMatches("MAC NVIDIA 0x0fd5 RELEASE"))
121 return;
122
123 content::DOMMessageQueue message_queue;
124
125 // Load page and wait for it to load.
126 content::WindowedNotificationObserver observer(
127 content::NOTIFICATION_LOAD_STOP,
128 content::NotificationService::AllSources());
129 ui_test_utils::NavigateToURL(
130 browser(),
131 content::GetFileUrlWithQuery(
132 gpu_test_dir_.AppendASCII("webgl.html"),
133 "query=kill_after_notification"));
134 observer.Wait();
135
136 std::string m;
137 ASSERT_TRUE(message_queue.WaitForMessage(&m));
138 EXPECT_EQ("\"LOADED\"", m);
139
140 message_queue.ClearQueue();
141
142 content::WindowedNotificationObserver infobar_added(
143 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
144 content::NotificationService::AllSources());
145 SimulateGPUCrash(browser());
146 infobar_added.Wait();
147 ASSERT_EQ(1u,
148 InfoBarService::FromWebContents(
149 chrome::GetActiveWebContents(browser()))->GetInfoBarCount());
150 InfoBarDelegate* delegate =
151 InfoBarService::FromWebContents(
152 chrome::GetActiveWebContents(browser()))->GetInfoBarDelegateAt(0);
153 ASSERT_TRUE(delegate);
154 ASSERT_TRUE(delegate->AsThreeDAPIInfoBarDelegate());
155 delegate->AsConfirmInfoBarDelegate()->Cancel();
156
157 // The page should reload and another message sent to the
158 // DomAutomationController.
159 m = "";
160 ASSERT_TRUE(message_queue.WaitForMessage(&m));
161 EXPECT_EQ("\"LOADED\"", m);
162 }
163
164 // There isn't any point in adding a test which calls Accept() on the
165 // ThreeDAPIInfoBarDelegate; doing so doesn't remove the infobar, and
166 // there's no concrete event that could be observed in response.
167
168 IN_PROC_BROWSER_TEST_F(GPUCrashTest, WebkitLoseContext) {
169 content::DOMMessageQueue message_queue;
170
171 ui_test_utils::NavigateToURL(
172 browser(),
173 content::GetFileUrlWithQuery(
174 gpu_test_dir_.AppendASCII("webgl.html"),
175 "query=WEBGL_lose_context"));
176
177 std::string m;
178 ASSERT_TRUE(message_queue.WaitForMessage(&m));
179 EXPECT_EQ("\"SUCCESS\"", m);
180 }
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/gpu/webgl_infobar_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698