mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +00:00
Nuke Builders Part 3: remove validation test builder expectations
BUG=dawn:125 Change-Id: I64a0b957e39b60334916ad71fb4beee5d8baa9db Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6162 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
cb2c64f7d9
commit
c3155205fa
@@ -35,20 +35,6 @@ class ValidationTest : public testing::Test {
|
||||
|
||||
void TearDown() override;
|
||||
|
||||
// Use these methods to add expectations on the validation of a builder. The expectations are
|
||||
// checked on test teardown. Adding an expectation is done like the following:
|
||||
//
|
||||
// dawn::Foo foo = AssertWillBe[Success|Error](device.CreateFooBuilder(), "my foo")
|
||||
// .SetBar(1)
|
||||
// .GetResult();
|
||||
//
|
||||
// The string argument is optional but will be printed when an expectations is missed, this
|
||||
// will help debug tests where multiple expectations are added.
|
||||
template<typename Builder>
|
||||
Builder AssertWillBeSuccess(Builder builder, std::string debugName = "");
|
||||
template<typename Builder>
|
||||
Builder AssertWillBeError(Builder builder, std::string debugName = "");
|
||||
|
||||
void StartExpectDeviceError();
|
||||
bool EndExpectDeviceError();
|
||||
std::string GetLastDeviceErrorMessage() const;
|
||||
@@ -78,47 +64,6 @@ class ValidationTest : public testing::Test {
|
||||
std::string mDeviceErrorMessage;
|
||||
bool mExpectError = false;
|
||||
bool mError = false;
|
||||
|
||||
struct BuilderStatusExpectations {
|
||||
bool expectSuccess;
|
||||
std::string debugName;
|
||||
|
||||
bool gotStatus = false;
|
||||
std::string statusMessage;
|
||||
DawnBuilderErrorStatus status;
|
||||
};
|
||||
std::vector<BuilderStatusExpectations> mExpectations;
|
||||
|
||||
template<typename Builder>
|
||||
Builder AddExpectation(Builder& builder, std::string debugName, bool expectSuccess);
|
||||
|
||||
static void OnBuilderErrorStatus(DawnBuilderErrorStatus status, const char* message, dawn::CallbackUserdata userdata1, dawn::CallbackUserdata userdata2);
|
||||
};
|
||||
|
||||
// Template implementation details
|
||||
|
||||
template<typename Builder>
|
||||
Builder ValidationTest::AssertWillBeSuccess(Builder builder, std::string debugName) {
|
||||
return AddExpectation(builder, debugName, true);
|
||||
}
|
||||
|
||||
template<typename Builder>
|
||||
Builder ValidationTest::AssertWillBeError(Builder builder, std::string debugName) {
|
||||
return AddExpectation(builder, debugName, false);
|
||||
}
|
||||
|
||||
template<typename Builder>
|
||||
Builder ValidationTest::AddExpectation(Builder& builder, std::string debugName, bool expectSuccess) {
|
||||
uint64_t userdata1 = reinterpret_cast<uintptr_t>(this);
|
||||
uint64_t userdata2 = mExpectations.size();
|
||||
builder.SetErrorCallback(OnBuilderErrorStatus, userdata1, userdata2);
|
||||
|
||||
mExpectations.emplace_back();
|
||||
auto& expectation = mExpectations.back();
|
||||
expectation.expectSuccess = expectSuccess;
|
||||
expectation.debugName = debugName;
|
||||
|
||||
return std::move(builder);
|
||||
}
|
||||
|
||||
#endif // TESTS_UNITTESTS_VALIDATIONTEST_H_
|
||||
|
||||
Reference in New Issue
Block a user