Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(476)

Side by Side Diff: gpu/command_buffer/tests/egl_test.cc

Issue 2023333002: Migrate WaitableEvent to enum-based constructor in gpu/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "testing/gmock/include/gmock/gmock.h" 5 #include "testing/gmock/include/gmock/gmock.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 #include <EGL/egl.h> 8 #include <EGL/egl.h>
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 10
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 }; 504 };
505 505
506 EGLThreadTest::EGLThreadTest() 506 EGLThreadTest::EGLThreadTest()
507 : EGLSurfaceTest(), other_thread_("EGLThreadTest thread") {} 507 : EGLSurfaceTest(), other_thread_("EGLThreadTest thread") {}
508 void EGLThreadTest::SetUp() { 508 void EGLThreadTest::SetUp() {
509 EGLSurfaceTest::SetUp(); 509 EGLSurfaceTest::SetUp();
510 other_thread_.Start(); 510 other_thread_.Start();
511 } 511 }
512 512
513 void EGLThreadTest::TearDown() { 513 void EGLThreadTest::TearDown() {
514 base::WaitableEvent completion(true, false); 514 base::WaitableEvent completion(
515 base::WaitableEvent::ResetPolicy::MANUAL,
516 base::WaitableEvent::InitialState::NOT_SIGNALED);
515 other_thread_.task_runner()->PostTask( 517 other_thread_.task_runner()->PostTask(
516 FROM_HERE, base::Bind(&EGLThreadTest::OtherThreadTearDown, 518 FROM_HERE, base::Bind(&EGLThreadTest::OtherThreadTearDown,
517 base::Unretained(this), &completion)); 519 base::Unretained(this), &completion));
518 completion.Wait(); 520 completion.Wait();
519 other_thread_.Stop(); 521 other_thread_.Stop();
520 EGLSurfaceTest::TearDown(); 522 EGLSurfaceTest::TearDown();
521 } 523 }
522 524
523 void EGLThreadTest::OtherThreadTearDown(base::WaitableEvent* completion) { 525 void EGLThreadTest::OtherThreadTearDown(base::WaitableEvent* completion) {
524 EXPECT_TRUE(eglReleaseThread()); 526 EXPECT_TRUE(eglReleaseThread());
(...skipping 18 matching lines...) Expand all
543 545
544 TEST_F(EGLThreadTest, Basic) { 546 TEST_F(EGLThreadTest, Basic) {
545 EGLSurface surface; 547 EGLSurface surface;
546 EGLContext context; 548 EGLContext context;
547 CreateSurfaceAndContext(&surface, &context); 549 CreateSurfaceAndContext(&surface, &context);
548 EXPECT_NE(EGL_NO_SURFACE, surface); 550 EXPECT_NE(EGL_NO_SURFACE, surface);
549 EXPECT_NE(EGL_NO_CONTEXT, context); 551 EXPECT_NE(EGL_NO_CONTEXT, context);
550 552
551 EXPECT_TRUE(eglMakeCurrent(display_, surface, surface, context)); 553 EXPECT_TRUE(eglMakeCurrent(display_, surface, surface, context));
552 554
553 base::WaitableEvent completion(false, false); 555 base::WaitableEvent completion(
556 base::WaitableEvent::ResetPolicy::AUTOMATIC,
557 base::WaitableEvent::InitialState::NOT_SIGNALED);
554 558
555 EGLBoolean result = EGL_FALSE; 559 EGLBoolean result = EGL_FALSE;
556 other_thread_.task_runner()->PostTask( 560 other_thread_.task_runner()->PostTask(
557 FROM_HERE, 561 FROM_HERE,
558 base::Bind(&EGLThreadTest::OtherThreadMakeCurrent, base::Unretained(this), 562 base::Bind(&EGLThreadTest::OtherThreadMakeCurrent, base::Unretained(this),
559 surface, context, &result, &completion)); 563 surface, context, &result, &completion));
560 completion.Wait(); 564 completion.Wait();
561 EXPECT_FALSE(result); 565 EXPECT_FALSE(result);
562 EXPECT_EQ(EGL_SUCCESS, eglGetError()); 566 EXPECT_EQ(EGL_SUCCESS, eglGetError());
563 567
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 EGLContext context = 621 EGLContext context =
618 eglCreateContext(display, config, nullptr, context_attribs); 622 eglCreateContext(display, config, nullptr, context_attribs);
619 EXPECT_TRUE(eglMakeCurrent(display, surface, surface, context)); 623 EXPECT_TRUE(eglMakeCurrent(display, surface, surface, context));
620 EXPECT_TRUE(eglSwapBuffers(display, surface)); 624 EXPECT_TRUE(eglSwapBuffers(display, surface));
621 625
622 EXPECT_TRUE(eglDestroySurface(display, surface)); 626 EXPECT_TRUE(eglDestroySurface(display, surface));
623 EXPECT_TRUE(eglDestroyContext(display, context)); 627 EXPECT_TRUE(eglDestroyContext(display, context));
624 } 628 }
625 629
626 } // namespace gpu 630 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698