summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 00:04:05 +0000
committerzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 00:04:05 +0000
commitf9c8928e81b64ac58a9119a85f49da2b66dd65b9 (patch)
treed138052c145e80f934b7161b2f585418a91c7e83
parent03ba191c1308120bbb9bd116d8ceb16bcafa0f94 (diff)
downloadchromium_src-f9c8928e81b64ac58a9119a85f49da2b66dd65b9.zip
chromium_src-f9c8928e81b64ac58a9119a85f49da2b66dd65b9.tar.gz
chromium_src-f9c8928e81b64ac58a9119a85f49da2b66dd65b9.tar.bz2
Get GpuCrashTest running in content_browsertests.
1) The test class name should begin with "Gpu" to be picked by gpu bot filters. 2) implify gpu crash tests by directly call the SimulateCrash function. Before we open a new tab, go to about:gpucrash. This is really unnecessary. 3) Disable infobar stuff for Kill - otherwise the GPU process won't launch after crashing. 4) Clean up the webgl.html a little bit. BUG=111506 TEST=gpu bots Review URL: https://codereview.chromium.org/11824045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175933 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/gpu/gpu_crash_browsertest.cc40
-rw-r--r--content/test/data/gpu/webgl.html19
2 files changed, 17 insertions, 42 deletions
diff --git a/content/browser/gpu/gpu_crash_browsertest.cc b/content/browser/gpu/gpu_crash_browsertest.cc
index 21df192..23a0cc7 100644
--- a/content/browser/gpu/gpu_crash_browsertest.cc
+++ b/content/browser/gpu/gpu_crash_browsertest.cc
@@ -2,40 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/command_line.h"
-#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
-#include "base/utf_string_conversions.h"
+#include "content/browser/gpu/gpu_data_manager_impl.h"
+#include "content/browser/gpu/gpu_process_host_ui_shim.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "content/public/common/content_paths.h"
-#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "content/shell/shell.h"
#include "content/test/content_browser_test.h"
#include "content/test/content_browser_test_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gl/gl_implementation.h"
-
-namespace {
-
-void SimulateGPUCrash(content::Shell* s) {
- LOG(ERROR) << "SimulateGPUCrash, before LoadURL";
- s->LoadURL(GURL(chrome::kChromeUIGpuCrashURL));
- LOG(ERROR) << "SimulateGPUCrash, after LoadURL";
-}
-
-} // namespace
namespace content {
-class GPUCrashTest : public ContentBrowserTest {
+class GpuCrashTest : public ContentBrowserTest {
protected:
- virtual void SetUpCommandLine(CommandLine* command_line) {
- // GPU tests require gpu acceleration.
- // We do not care which GL backend is used.
- command_line->AppendSwitchASCII(switches::kUseGL, "any");
- }
virtual void SetUpInProcessBrowserTestFixture() {
FilePath test_dir;
ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &test_dir));
@@ -44,10 +25,12 @@ class GPUCrashTest : public ContentBrowserTest {
FilePath gpu_test_dir_;
};
-// Currently Kill times out on GPU bots: http://crbug.com/101513
-IN_PROC_BROWSER_TEST_F(GPUCrashTest, MANUAL_Kill) {
+IN_PROC_BROWSER_TEST_F(GpuCrashTest, MANUAL_Kill) {
DOMMessageQueue message_queue;
+ content::GpuDataManagerImpl::GetInstance()->
+ DisableDomainBlockingFor3DAPIsForTesting();
+
// Load page and wait for it to load.
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
@@ -58,16 +41,17 @@ IN_PROC_BROWSER_TEST_F(GPUCrashTest, MANUAL_Kill) {
gpu_test_dir_.AppendASCII("webgl.html"), "query=kill"));
observer.Wait();
- scoped_ptr<Shell> shell(CreateBrowser());
- SimulateGPUCrash(shell.get());
+ GpuProcessHostUIShim* host =
+ GpuProcessHostUIShim::GetOneInstance();
+ ASSERT_TRUE(host);
+ host->SimulateCrash();
std::string m;
ASSERT_TRUE(message_queue.WaitForMessage(&m));
EXPECT_EQ("\"SUCCESS\"", m);
}
-
-IN_PROC_BROWSER_TEST_F(GPUCrashTest, MANUAL_WebkitLoseContext) {
+IN_PROC_BROWSER_TEST_F(GpuCrashTest, MANUAL_WebkitLoseContext) {
DOMMessageQueue message_queue;
NavigateToURL(
diff --git a/content/test/data/gpu/webgl.html b/content/test/data/gpu/webgl.html
index 18bed47..001c569 100644
--- a/content/test/data/gpu/webgl.html
+++ b/content/test/data/gpu/webgl.html
@@ -34,6 +34,7 @@ function testContextLost(e) {
if (extension) {
setTimeout(function() {
extension.restoreContext();
+ extension = null;
}, 0);
}
}
@@ -85,31 +86,21 @@ function onLoad() {
canvas = document.getElementById("canvas1");
w = canvas.width;
h = canvas.height;
- if (!canvas) {
- document.title = "FAILED: canvas element not found";
+ if (!canvas)
return;
- }
canvas.addEventListener("webglcontextlost", testContextLost, false);
canvas.addEventListener("webglcontextrestored", testContextRestored, false);
gl = canvas.getContext("experimental-webgl");
- if (!gl) {
- document.title = "FAILED: could not get webgl context for canvas";
+ if (!gl)
return;
- }
- if (!testHorizontalBands()) {
- document.title = "FAILED: did not render correctly";
+ if (!testHorizontalBands())
return;
- }
var query = /query=(.*)/.exec(window.location.href);
- if (query) {
+ if (query)
contextLostTest(query[1]);
- } else {
- var renderer = gl.getParameter(gl.RENDERER);
- document.title = "SUCCESS: " + renderer;
- }
}
</script>
</head>