| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "content/browser/compositor/image_transport_factory.h" | 9 #include "content/browser/compositor/image_transport_factory.h" |
| 10 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 10 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 #define MAYBE_Basic Basic | 176 #define MAYBE_Basic Basic |
| 177 #else | 177 #else |
| 178 #define MAYBE_Basic DISABLED_Basic | 178 #define MAYBE_Basic DISABLED_Basic |
| 179 #endif | 179 #endif |
| 180 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, MAYBE_Basic) { | 180 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, MAYBE_Basic) { |
| 181 DCHECK(!IsChannelEstablished()); | 181 DCHECK(!IsChannelEstablished()); |
| 182 EstablishAndWait(); | 182 EstablishAndWait(); |
| 183 EXPECT_TRUE(GetGpuChannel() != NULL); | 183 EXPECT_TRUE(GetGpuChannel() != NULL); |
| 184 } | 184 } |
| 185 | 185 |
| 186 // Test fails on Chromeos + Mac, flaky on Windows because UI Compositor | |
| 187 // establishes a GPU channel. | |
| 188 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | |
| 189 #define MAYBE_EstablishAndTerminate EstablishAndTerminate | |
| 190 #else | |
| 191 #define MAYBE_EstablishAndTerminate DISABLED_EstablishAndTerminate | |
| 192 #endif | |
| 193 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, | |
| 194 MAYBE_EstablishAndTerminate) { | |
| 195 DCHECK(!IsChannelEstablished()); | |
| 196 base::RunLoop run_loop; | |
| 197 GetFactory()->EstablishGpuChannel( | |
| 198 base::Bind(&OnEstablishedGpuChannel, run_loop.QuitClosure(), nullptr)); | |
| 199 GetFactory()->Terminate(); | |
| 200 | |
| 201 // The callback should still trigger. | |
| 202 run_loop.Run(); | |
| 203 } | |
| 204 | |
| 205 #if !defined(OS_ANDROID) | 186 #if !defined(OS_ANDROID) |
| 206 // Test fails on Chromeos + Mac, flaky on Windows because UI Compositor | 187 // Test fails on Chromeos + Mac, flaky on Windows because UI Compositor |
| 207 // establishes a GPU channel. | 188 // establishes a GPU channel. |
| 208 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 189 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 209 #define MAYBE_AlreadyEstablished AlreadyEstablished | 190 #define MAYBE_AlreadyEstablished AlreadyEstablished |
| 210 #else | 191 #else |
| 211 #define MAYBE_AlreadyEstablished DISABLED_AlreadyEstablished | 192 #define MAYBE_AlreadyEstablished DISABLED_AlreadyEstablished |
| 212 #endif | 193 #endif |
| 213 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, | 194 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, |
| 214 MAYBE_AlreadyEstablished) { | 195 MAYBE_AlreadyEstablished) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 shim->SimulateCrash(); | 289 shim->SimulateCrash(); |
| 309 run_loop.Run(); | 290 run_loop.Run(); |
| 310 | 291 |
| 311 EXPECT_EQ(1, counter); | 292 EXPECT_EQ(1, counter); |
| 312 EXPECT_FALSE(IsChannelEstablished()); | 293 EXPECT_FALSE(IsChannelEstablished()); |
| 313 EstablishAndWait(); | 294 EstablishAndWait(); |
| 314 EXPECT_TRUE(IsChannelEstablished()); | 295 EXPECT_TRUE(IsChannelEstablished()); |
| 315 } | 296 } |
| 316 | 297 |
| 317 } // namespace content | 298 } // namespace content |
| OLD | NEW |