| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "app/gfx/gl/gl_implementation.h" |
| 7 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/test/test_launcher_utils.h" |
| 8 #include "chrome/test/ui/ui_test.h" | 11 #include "chrome/test/ui/ui_test.h" |
| 9 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
| 10 | 13 |
| 11 class GPUUITest : public UITest { | 14 class GPUUITest : public UITest { |
| 12 protected: | 15 protected: |
| 13 GPUUITest() { | 16 GPUUITest() { |
| 14 } | 17 } |
| 15 | 18 |
| 16 virtual void SetUp() { | 19 virtual void SetUp() { |
| 20 EXPECT_TRUE(test_launcher_utils::OverrideGLImplementation( |
| 21 &launch_arguments_, |
| 22 gfx::kGLImplementationOSMesaName)); |
| 23 |
| 24 #if defined(OS_MACOSX) |
| 25 // Accelerated compositing does not work with OSMesa. AcceleratedSurface |
| 26 // assumes GL contexts are native. |
| 27 launch_arguments_.AppendSwitch(switches::kDisableAcceleratedCompositing); |
| 28 #endif |
| 29 |
| 17 UITest::SetUp(); | 30 UITest::SetUp(); |
| 31 |
| 18 gpu_test_dir_ = test_data_directory_.AppendASCII("gpu"); | 32 gpu_test_dir_ = test_data_directory_.AppendASCII("gpu"); |
| 19 } | 33 } |
| 20 | 34 |
| 21 FilePath gpu_test_dir_; | 35 FilePath gpu_test_dir_; |
| 22 }; | 36 }; |
| 23 | 37 |
| 24 TEST_F(GPUUITest, UITestLaunchedWithOSMesa) { | 38 TEST_F(GPUUITest, UITestCanLaunchWithOSMesa) { |
| 25 // Check the webgl test reports success and that the renderer was OSMesa. | 39 // Check the webgl test reports success and that the renderer was OSMesa. |
| 26 // We use OSMesa for tests in order to get consistent results across a | |
| 27 // variety of boxes. | |
| 28 NavigateToURL( | 40 NavigateToURL( |
| 29 net::FilePathToFileURL(gpu_test_dir_.AppendASCII("webgl.html"))); | 41 net::FilePathToFileURL(gpu_test_dir_.AppendASCII("webgl.html"))); |
| 30 | 42 |
| 31 EXPECT_EQ(std::wstring(L"SUCCESS: Mesa OffScreen"), GetActiveTabTitle()); | 43 EXPECT_EQ(std::wstring(L"SUCCESS: Mesa OffScreen"), GetActiveTabTitle()); |
| 32 } | 44 } |
| OLD | NEW |