| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
| 9 #include "mojo/dart/embedder/dart_controller.h" | 9 #include "mojo/dart/embedder/dart_controller.h" |
| 10 #include "mojo/dart/embedder/test/dart_test.h" | 10 #include "mojo/dart/unittests/embedder_tester/dart_test.h" |
| 11 #include "mojo/public/c/system/types.h" | 11 #include "mojo/public/c/system/types.h" |
| 12 #include "mojo/public/cpp/environment/environment.h" | 12 #include "mojo/public/cpp/environment/environment.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace mojo { | 15 namespace mojo { |
| 16 namespace dart { | 16 namespace dart { |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 class DartUnitTest : public DartTest { | 19 class DartUnitTest : public DartTest { |
| 20 public: | 20 public: |
| 21 DartUnitTest() {} | 21 DartUnitTest() {} |
| 22 | 22 |
| 23 void RunTest(const std::string& test, | 23 void RunTest(const std::string& test, |
| 24 bool compile_all, | 24 bool compile_all, |
| 25 bool expect_unhandled_exception, | 25 bool expect_unhandled_exception, |
| 26 int expected_unclosed_handles) { | 26 int expected_unclosed_handles) { |
| 27 base::FilePath path; | 27 base::FilePath path; |
| 28 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 28 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 29 path = path.AppendASCII("mojo") | 29 path = path.AppendASCII("mojo") |
| 30 .AppendASCII("dart") | 30 .AppendASCII("dart") |
| 31 .AppendASCII("test") | 31 .AppendASCII("unittests") |
| 32 .AppendASCII("embedder_tests") |
| 32 .AppendASCII(test); | 33 .AppendASCII(test); |
| 33 std::vector<std::string> script_arguments; | 34 std::vector<std::string> script_arguments; |
| 34 | 35 |
| 35 RunDartTest(path, script_arguments, compile_all, | 36 RunDartTest(path, script_arguments, compile_all, |
| 36 expect_unhandled_exception, expected_unclosed_handles); | 37 expect_unhandled_exception, expected_unclosed_handles); |
| 37 } | 38 } |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 // TODO(zra): instead of listing all these tests, search //mojo/dart/test for | 41 // TODO(zra): instead of listing all these tests, search //mojo/dart/test for |
| 41 // _test.dart files. | 42 // _test.dart files. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 RunTest("unhandled_exception_test.dart", false, true, 2); | 109 RunTest("unhandled_exception_test.dart", false, true, 2); |
| 109 } | 110 } |
| 110 | 111 |
| 111 TEST_F(DartUnitTest, uri_base_test) { | 112 TEST_F(DartUnitTest, uri_base_test) { |
| 112 RunTest("uri_base_test.dart", false, false, 0); | 113 RunTest("uri_base_test.dart", false, false, 0); |
| 113 } | 114 } |
| 114 | 115 |
| 115 } // namespace | 116 } // namespace |
| 116 } // namespace dart | 117 } // namespace dart |
| 117 } // namespace mojo | 118 } // namespace mojo |
| OLD | NEW |