diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 20:22:24 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 20:22:24 +0000 |
commit | 689992c89d8db06b8a16682b89f0fa820fc135e9 (patch) | |
tree | ed02ba0c04865d437c625f89f001786cd0882d9e | |
parent | 7f39bae0568306aa98800b8b5150d68b279e3528 (diff) | |
download | chromium_src-689992c89d8db06b8a16682b89f0fa820fc135e9.zip chromium_src-689992c89d8db06b8a16682b89f0fa820fc135e9.tar.gz chromium_src-689992c89d8db06b8a16682b89f0fa820fc135e9.tar.bz2 |
Used use-gl=any instead of forcing osmesa for gpu browser tests.
This was committed as part of r105914, which was later reverted due to mysterious tsan failures. I am splitting the original patch into smaller chunks to figure out the failure.
Review URL: http://codereview.chromium.org/8347007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106113 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/gpu_browsertest.cc | 30 | ||||
-rw-r--r-- | chrome/browser/gpu_crash_browsertest.cc | 14 | ||||
-rw-r--r-- | chrome/browser/gpu_pixel_browsertest.cc | 52 |
3 files changed, 24 insertions, 72 deletions
diff --git a/chrome/browser/gpu_browsertest.cc b/chrome/browser/gpu_browsertest.cc index 333e783..37b68ca 100644 --- a/chrome/browser/gpu_browsertest.cc +++ b/chrome/browser/gpu_browsertest.cc @@ -33,40 +33,16 @@ class GPUBrowserTest : public InProcessBrowserTest { virtual void SetUpCommandLine(CommandLine* command_line) { InProcessBrowserTest::SetUpCommandLine(command_line); - EXPECT_TRUE(test_launcher_utils::OverrideGLImplementation( - command_line, - gfx::kGLImplementationOSMesaName)); + // GPU tests require gpu acceleration. + // We do not care which GL backend is used. + command_line->AppendSwitchASCII(switches::kUseGL, "any"); command_line->AppendSwitch(switches::kDisablePopupBlocking); - -#if defined(OS_MACOSX) - // Accelerated compositing does not work with OSMesa. AcceleratedSurface - // assumes GL contexts are native. - command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); -#endif } FilePath gpu_test_dir_; }; -#if defined(TOOLKIT_VIEWS) -// Flaky on Windows (dbg): http://crbug.com/72608 -// For ChromeOS: http://crbug.com/76217 -#define MAYBE_BrowserTestCanLaunchWithOSMesa DISABLED_BrowserTestCanLaunchWithOSMesa -#else -#define MAYBE_BrowserTestCanLaunchWithOSMesa BrowserTestCanLaunchWithOSMesa -#endif - -IN_PROC_BROWSER_TEST_F(GPUBrowserTest, MAYBE_BrowserTestCanLaunchWithOSMesa) { - // Check the webgl test reports success and that the renderer was OSMesa. - ui_test_utils::NavigateToURL( - browser(), - net::FilePathToFileURL(gpu_test_dir_.AppendASCII("webgl.html"))); - - EXPECT_EQ(ASCIIToUTF16("SUCCESS: WebKit WebGL"), - browser()->GetSelectedTabContents()->GetTitle()); -} - // Test is flaky and timing out. See crbug.com/99883 IN_PROC_BROWSER_TEST_F(GPUBrowserTest, DISABLED_CanOpenPopupAndRenderWithWebGLCanvas) { diff --git a/chrome/browser/gpu_crash_browsertest.cc b/chrome/browser/gpu_crash_browsertest.cc index 344bcd8..a8cf8d9 100644 --- a/chrome/browser/gpu_crash_browsertest.cc +++ b/chrome/browser/gpu_crash_browsertest.cc @@ -35,17 +35,9 @@ class GPUCrashTest : public InProcessBrowserTest { EnableDOMAutomation(); 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 + // 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; diff --git a/chrome/browser/gpu_pixel_browsertest.cc b/chrome/browser/gpu_pixel_browsertest.cc index f4a7baa..92d6134 100644 --- a/chrome/browser/gpu_pixel_browsertest.cc +++ b/chrome/browser/gpu_pixel_browsertest.cc @@ -109,25 +109,12 @@ class GpuPixelBrowserTest : public InProcessBrowserTest { // This enables DOM automation for tab contents. EnableDOMAutomation(); - // These tests by default use OSMesa. This can be changed if the |kUseGL| - // switch is explicitly set to something else or if |kUseGpuInTests| is - // present. - if (command_line->HasSwitch(switches::kUseGL)) { - using_gpu_ = command_line->GetSwitchValueASCII(switches::kUseGL) != - gfx::kGLImplementationOSMesaName; - } else if (command_line->HasSwitch(kUseGpuInTests)) { - using_gpu_ = true; - } else { - // OSMesa will be used by default. - 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 - using_gpu_ = false; + // These tests by default use any GL implementation it can find. + // This can be changed if the |kUseGL| switch is explicitly set to + // something or if |kUseGpuInTests| is present. + if (!command_line->HasSwitch(switches::kUseGL) && + !command_line->HasSwitch(kUseGpuInTests)) { + command_line->AppendSwitchASCII(switches::kUseGL, "any"); } // Allow file access from "file://" protocol. Otherwise, test fails with // "Uncaught Error: SECURITY_ERR: DOM Exception 18." @@ -144,11 +131,6 @@ class GpuPixelBrowserTest : public InProcessBrowserTest { else generated_img_dir_ = test_data_dir_.AppendASCII("generated"); - if (using_gpu_) - reference_img_dir_ = test_data_dir_.AppendASCII("gpu_reference"); - else - reference_img_dir_ = test_data_dir_.AppendASCII("sw_reference"); - test_name_ = testing::UnitTest::GetInstance()->current_test_info()->name(); const char* test_status_prefixes[] = {"DISABLED_", "FLAKY_", "FAILS_"}; for (size_t i = 0; i < arraysize(test_status_prefixes); ++i) { @@ -172,6 +154,7 @@ class GpuPixelBrowserTest : public InProcessBrowserTest { bool CompareImages(const SkBitmap& gen_bmp, const std::string& postfix) { // Determine the name of the image. std::string img_name = test_name_; + FilePath ref_img_dir; if (postfix.length()) img_name += "_" + postfix; #if defined(OS_WIN) @@ -183,21 +166,25 @@ class GpuPixelBrowserTest : public InProcessBrowserTest { #else #error "Not implemented for this platform" #endif - if (using_gpu_) { - GPUInfo info; - if (!GetGPUInfo(&info)) { - LOG(ERROR) << "Could not get gpu info"; - return false; - } + GPUInfo info; + if (!GetGPUInfo(&info)) { + LOG(ERROR) << "Could not get gpu info"; + return false; + } + // TODO(alokp): Why do we treat Mesa differently? + bool using_gpu = info.gl_renderer.compare(0, 4, "Mesa") != 0; + if (using_gpu) { + ref_img_dir = test_data_dir_.AppendASCII("gpu_reference"); img_name = base::StringPrintf("%s_%s_%04x-%04x.png", img_name.c_str(), os_label, info.vendor_id, info.device_id); } else { + ref_img_dir = test_data_dir_.AppendASCII("sw_reference"); img_name = base::StringPrintf("%s_%s_mesa.png", img_name.c_str(), os_label); } // Read the reference image and verify the images' dimensions are equal. - FilePath ref_img_path = reference_img_dir_.AppendASCII(img_name); + FilePath ref_img_path = ref_img_dir.AppendASCII(img_name); SkBitmap ref_bmp; bool should_compare = true; if (!ReadPNGFile(ref_img_path, &ref_bmp)) { @@ -264,12 +251,9 @@ class GpuPixelBrowserTest : public InProcessBrowserTest { FilePath test_data_dir_; private: - FilePath reference_img_dir_; FilePath generated_img_dir_; // The name of the test, with any special prefixes dropped. std::string test_name_; - // Whether the gpu, or OSMesa is being used for rendering. - bool using_gpu_; DISALLOW_COPY_AND_ASSIGN(GpuPixelBrowserTest); }; |