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

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

Issue 2774653002: Support for parsing external file references in a glTF resource. (Closed)
Patch Set: Safer code for relative paths. Created 3 years, 9 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 ff30ce2bbde61ea112db687f0d5c58d2947d4fec..567632060ef3be64836d10927675e7d797aa2418 100644
--- a/chrome/browser/android/vr_shell/gltf_parser_unittest.cc
+++ b/chrome/browser/android/vr_shell/gltf_parser_unittest.cc
@@ -17,11 +17,18 @@
namespace vr_shell {
-TEST(GltfParser, Parse) {
- test::RegisterPathProvider();
- base::FilePath gltf_path;
- PathService::Get(test::DIR_TEST_DATA, &gltf_path);
- gltf_path = gltf_path.Append("sample_inline.gltf");
+class GltfParserTest : public testing::Test {
+ protected:
+ void SetUp() override {
+ test::RegisterPathProvider();
+ PathService::Get(test::DIR_TEST_DATA, &data_dir_);
+ }
+
+ base::FilePath data_dir_;
+};
+
+TEST_F(GltfParserTest, Parse) {
+ auto gltf_path = data_dir_.Append("sample_inline.gltf");
int error_code;
std::string error_msg;
@@ -92,4 +99,16 @@ TEST(GltfParser, Parse) {
EXPECT_EQ(scene, gltf_model->GetMainScene());
}
+TEST_F(GltfParserTest, ParseExternal) {
+ auto gltf_path = data_dir_.Append("sample_external.gltf");
+
+ GltfParser parser;
+ auto gltf_model = parser.Parse(gltf_path);
+ EXPECT_NE(nullptr, gltf_model);
+ const gltf::Buffer* buffer = gltf_model->GetBuffer(0);
+ EXPECT_NE(nullptr, buffer);
+ EXPECT_EQ("HELLO WORLD!", *buffer);
+ EXPECT_EQ(12u, buffer->length());
+}
+
} // namespace vr_shell

Powered by Google App Engine
This is Rietveld 408576698