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

Unified Diff: chrome/browser/android/vr_shell/gltf_parser_unittest.cc

Issue 2852533004: Implementing Binary glTF reader for the VR controller model (Closed)
Patch Set: Avoiding auto Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/vr_shell/gltf_parser_unittest.cc
diff --git a/chrome/browser/android/vr_shell/gltf_parser_unittest.cc b/chrome/browser/android/vr_shell/gltf_parser_unittest.cc
index b7ff48ee342c367031a6689d985ae551129d705f..2e6c1e1935f00c5fd529e70dfd7759ba1cacb25e 100644
--- a/chrome/browser/android/vr_shell/gltf_parser_unittest.cc
+++ b/chrome/browser/android/vr_shell/gltf_parser_unittest.cc
@@ -17,18 +17,23 @@
namespace vr_shell {
-class GltfParserTest : public testing::Test {
+class DataDrivenTest : public testing::Test {
protected:
static void SetUpTestCase() { test::RegisterPathProvider(); }
void SetUp() override { PathService::Get(test::DIR_TEST_DATA, &data_dir_); }
base::FilePath data_dir_;
+};
+class GltfParserTest : public DataDrivenTest {
+ protected:
std::unique_ptr<base::DictionaryValue> Deserialize(
const base::FilePath& gltf_path);
};
+class BinaryGltfParserTest : public DataDrivenTest {};
+
std::unique_ptr<base::DictionaryValue> GltfParserTest::Deserialize(
const base::FilePath& gltf_path) {
int error_code;
@@ -47,7 +52,7 @@ TEST_F(GltfParserTest, Parse) {
GltfParser parser;
std::vector<std::unique_ptr<gltf::Buffer>> buffers;
- auto gltf_model = parser.Parse(*asset, &buffers);
+ std::unique_ptr<gltf::Asset> gltf_model = parser.Parse(*asset, &buffers);
EXPECT_TRUE(gltf_model);
EXPECT_EQ(1u, buffers.size());
@@ -139,7 +144,7 @@ TEST_F(GltfParserTest, ParseExternal) {
GltfParser parser;
std::vector<std::unique_ptr<gltf::Buffer>> buffers;
- auto gltf_model = parser.Parse(gltf_path, &buffers);
+ std::unique_ptr<gltf::Asset> gltf_model = parser.Parse(gltf_path, &buffers);
EXPECT_NE(nullptr, gltf_model);
EXPECT_EQ(1u, buffers.size());
const gltf::Buffer* buffer = buffers[0].get();
@@ -157,4 +162,18 @@ TEST_F(GltfParserTest, ParseExternalNoPath) {
EXPECT_EQ(nullptr, parser.Parse(*asset, &buffers));
}
+TEST_F(BinaryGltfParserTest, ParseBinary) {
+ std::string data;
+ EXPECT_TRUE(base::ReadFileToString(data_dir_.Append("sample.glb"), &data));
+ base::StringPiece glb_data(data);
+ std::vector<std::unique_ptr<gltf::Buffer>> buffers;
+ std::unique_ptr<gltf::Asset> asset =
+ BinaryGltfParser::Parse(glb_data, &buffers);
+ EXPECT_TRUE(asset);
+ EXPECT_EQ(1u, buffers.size());
+ const gltf::BufferView* buffer_view = asset->GetBufferView(0);
+ EXPECT_TRUE(buffer_view);
+ EXPECT_EQ(0, buffer_view->buffer);
+}
+
} // namespace vr_shell
« no previous file with comments | « chrome/browser/android/vr_shell/gltf_parser.cc ('k') | chrome/browser/android/vr_shell/test/data/sample.glb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698