| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/android/vr_shell/gltf_parser.h" | 5 #include "chrome/browser/android/vr_shell/gltf_parser.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/json/json_file_value_serializer.h" | 11 #include "base/json/json_file_value_serializer.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/android/vr_shell/test/paths.h" | 15 #include "chrome/browser/android/vr_shell/test/paths.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace vr_shell { | 18 namespace vr_shell { |
| 19 | 19 |
| 20 class GltfParserTest : public testing::Test { | 20 class GltfParserTest : public testing::Test { |
| 21 protected: | 21 protected: |
| 22 void SetUp() override { | 22 static void SetUpTestCase() { test::RegisterPathProvider(); } |
| 23 test::RegisterPathProvider(); | 23 |
| 24 PathService::Get(test::DIR_TEST_DATA, &data_dir_); | 24 void SetUp() override { PathService::Get(test::DIR_TEST_DATA, &data_dir_); } |
| 25 } | |
| 26 | 25 |
| 27 base::FilePath data_dir_; | 26 base::FilePath data_dir_; |
| 28 | 27 |
| 29 std::unique_ptr<base::DictionaryValue> Deserialize( | 28 std::unique_ptr<base::DictionaryValue> Deserialize( |
| 30 const base::FilePath& gltf_path); | 29 const base::FilePath& gltf_path); |
| 31 }; | 30 }; |
| 32 | 31 |
| 33 std::unique_ptr<base::DictionaryValue> GltfParserTest::Deserialize( | 32 std::unique_ptr<base::DictionaryValue> GltfParserTest::Deserialize( |
| 34 const base::FilePath& gltf_path) { | 33 const base::FilePath& gltf_path) { |
| 35 int error_code; | 34 int error_code; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 146 |
| 148 TEST_F(GltfParserTest, ParseExternalNoPath) { | 147 TEST_F(GltfParserTest, ParseExternalNoPath) { |
| 149 auto asset = Deserialize(data_dir_.Append("sample_external.gltf")); | 148 auto asset = Deserialize(data_dir_.Append("sample_external.gltf")); |
| 150 GltfParser parser; | 149 GltfParser parser; |
| 151 | 150 |
| 152 // Parsing fails when no path is provided. | 151 // Parsing fails when no path is provided. |
| 153 EXPECT_EQ(nullptr, parser.Parse(*asset)); | 152 EXPECT_EQ(nullptr, parser.Parse(*asset)); |
| 154 } | 153 } |
| 155 | 154 |
| 156 } // namespace vr_shell | 155 } // namespace vr_shell |
| OLD | NEW |