diff options
author | amarinichev@chromium.org <amarinichev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-23 22:17:08 +0000 |
---|---|---|
committer | amarinichev@chromium.org <amarinichev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-23 22:17:08 +0000 |
commit | e82c0b8d6b25fceb104f17422db7e149adf1aac1 (patch) | |
tree | 8205cfef2ad8bd7bea9bb68b673b68a86bce884f /chrome/test/gpu | |
parent | b7cc1dcbb04a9908de23c9ca1ba17a09ea726845 (diff) | |
download | chromium_src-e82c0b8d6b25fceb104f17422db7e149adf1aac1.zip chromium_src-e82c0b8d6b25fceb104f17422db7e149adf1aac1.tar.gz chromium_src-e82c0b8d6b25fceb104f17422db7e149adf1aac1.tar.bz2 |
Added GPUCrashTest.
BUG=none
TEST=set kGpuMaxCrashCount to zero and verified the test fails
Review URL: http://codereview.chromium.org/6705008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79194 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/gpu')
-rw-r--r-- | chrome/test/gpu/gpu_crash.cc | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/chrome/test/gpu/gpu_crash.cc b/chrome/test/gpu/gpu_crash.cc new file mode 100644 index 0000000..e998142 --- /dev/null +++ b/chrome/test/gpu/gpu_crash.cc @@ -0,0 +1,64 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "app/gfx/gl/gl_implementation.h" +#include "base/path_service.h" +#include "base/utf_string_conversions.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/common/url_constants.h" +#include "chrome/test/in_process_browser_test.h" +#include "chrome/test/test_launcher_utils.h" +#include "chrome/test/ui_test_utils.h" +#include "content/browser/tab_contents/tab_contents.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +void SimulateGPUCrash(Browser* browser) { + LOG(ERROR) << "SimulateGPUCrash, before NavigateToURLWithDisposition"; + ui_test_utils::NavigateToURLWithDisposition(browser, + GURL(chrome::kAboutGpuCrashURL), NEW_FOREGROUND_TAB, + ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); + browser->CloseTab(); + LOG(ERROR) << "SimulateGPUCrash, after CloseTab"; +} + +} // namespace + +class GPUCrashTest : public InProcessBrowserTest { + protected: + virtual void SetUpCommandLine(CommandLine* command_line) { + InProcessBrowserTest::SetUpCommandLine(command_line); + + // OverrideGLImplementation and kDisableAcceleratedCompositing for + // OS_MACOSX are Taken verbatim from gpu_pixel_browsertest.cc and + // gpu_browsertest.cc. + EXPECT_TRUE(test_launcher_utils::OverrideGLImplementation( + command_line, + gfx::kGLImplementationOSMesaName)); +#if defined(OS_MACOSX) + // Accelerated compositing does not work with OSMesa. AcceleratedSurface + // assumes GL contexts are native. + command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); +#endif + } +}; + +IN_PROC_BROWSER_TEST_F(GPUCrashTest, Reload) { + FilePath test_dir; + ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); + FilePath gpu_test_dir_; + gpu_test_dir_ = test_dir.AppendASCII("gpu"); + + ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL( + gpu_test_dir_.AppendASCII("webgl.html"))); + + SimulateGPUCrash(browser()); + + browser()->Reload(CURRENT_TAB); + ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); + EXPECT_EQ(ASCIIToUTF16("SUCCESS"), + browser()->GetSelectedTabContents()->GetTitle().substr(0, 7)); +} |