diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-17 20:57:45 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-17 20:57:45 +0000 |
commit | d4b5299a6b28b7ef1e44fcbf751bbe6564ce8727 (patch) | |
tree | eebfe067228caf8986fa55c9515f22ca342eaa13 /chrome/browser/gpu_pixel_browsertest.cc | |
parent | 439715b7b5702c61e7609bc2b1fd3e8a0e1ccac9 (diff) | |
download | chromium_src-d4b5299a6b28b7ef1e44fcbf751bbe6564ce8727.zip chromium_src-d4b5299a6b28b7ef1e44fcbf751bbe6564ce8727.tar.gz chromium_src-d4b5299a6b28b7ef1e44fcbf751bbe6564ce8727.tar.bz2 |
Removed the ability to disable accelerated compositing for UI tests. There is no need to disable accelerated compositing on any platform. Mac bots are always accelerated. Mesa works fine on others.
BUG=95782
Review URL: http://codereview.chromium.org/7996010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105914 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gpu_pixel_browsertest.cc')
-rw-r--r-- | chrome/browser/gpu_pixel_browsertest.cc | 52 |
1 files changed, 18 insertions, 34 deletions
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); }; |