Hash :
e4faae21
Author :
Date :
2019-05-10T08:27:00
Rename state change notification messages. This makes the style use CamelCase instead of ALL_CAPS. It also cleans up some of the naming. It also changes some uses of the messages in some of the objects to hopefully be more consistent. See the comments added to the enum SubjectMessage in Observer.h for more details. Bug: angleproject:3427 Change-Id: I6dff4f6d335ecf1a27e48df65743b1490bd3025a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1600411 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
//
// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Observer_unittest:
// Unit tests for Observers and related classes.
#include <gtest/gtest.h>
#include "libANGLE/Observer.h"
using namespace angle;
using namespace testing;
namespace
{
struct ObserverClass : public ObserverInterface
{
void onSubjectStateChange(const gl::Context *context,
SubjectIndex index,
SubjectMessage message) override
{
wasNotified = true;
}
bool wasNotified = false;
};
// Test that Observer/Subject state change notifications work.
TEST(ObserverTest, BasicUsage)
{
Subject subject;
ObserverClass observer;
ObserverBinding binding(&observer, 0u);
binding.bind(&subject);
ASSERT_FALSE(observer.wasNotified);
subject.onStateChange(nullptr, SubjectMessage::SubjectChanged);
ASSERT_TRUE(observer.wasNotified);
}
} // anonymous namespace