| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/bind.h" | |
| 6 #include "base/files/file_path.h" | |
| 7 #include "base/path_service.h" | |
| 8 #include "base/rand_util.h" | |
| 9 #include "mojo/dart/embedder/dart_controller.h" | |
| 10 #include "mojo/dart/embedder/test/dart_test.h" | |
| 11 #include "mojo/public/c/system/types.h" | |
| 12 #include "mojo/public/cpp/environment/environment.h" | |
| 13 #include "testing/gtest/include/gtest/gtest.h" | |
| 14 | |
| 15 namespace mojo { | |
| 16 namespace dart { | |
| 17 namespace { | |
| 18 | |
| 19 class DartUnitTest : public DartTest { | |
| 20 public: | |
| 21 DartUnitTest() {} | |
| 22 | |
| 23 void RunTest(const std::string& test, | |
| 24 bool compile_all, | |
| 25 bool expect_unhandled_exception, | |
| 26 int expected_unclosed_handles) { | |
| 27 base::FilePath path; | |
| 28 PathService::Get(base::DIR_SOURCE_ROOT, &path); | |
| 29 path = path.AppendASCII("mojo") | |
| 30 .AppendASCII("dart") | |
| 31 .AppendASCII("test") | |
| 32 .AppendASCII(test); | |
| 33 std::vector<std::string> script_arguments; | |
| 34 | |
| 35 RunDartTest(path, script_arguments, compile_all, | |
| 36 expect_unhandled_exception, expected_unclosed_handles); | |
| 37 } | |
| 38 }; | |
| 39 | |
| 40 // TODO(zra): instead of listing all these tests, search //mojo/dart/test for | |
| 41 // _test.dart files. | |
| 42 | |
| 43 TEST_F(DartUnitTest, async_await_test) { | |
| 44 RunTest("async_await_test.dart", false, false, 0); | |
| 45 } | |
| 46 | |
| 47 TEST_F(DartUnitTest, async_test) { | |
| 48 RunTest("async_test.dart", false, false, 0); | |
| 49 } | |
| 50 | |
| 51 TEST_F(DartUnitTest, bindings_generation_test) { | |
| 52 RunTest("bindings_generation_test.dart", false, false, 0); | |
| 53 } | |
| 54 | |
| 55 TEST_F(DartUnitTest, codec_test) { | |
| 56 RunTest("codec_test.dart", false, false, 0); | |
| 57 } | |
| 58 | |
| 59 TEST_F(DartUnitTest, compile_all_interfaces_test) { | |
| 60 RunTest("compile_all_interfaces_test.dart", true, false, 0); | |
| 61 } | |
| 62 | |
| 63 TEST_F(DartUnitTest, control_messages_test) { | |
| 64 RunTest("control_messages_test.dart", false, false, 0); | |
| 65 } | |
| 66 | |
| 67 TEST_F(DartUnitTest, core_test) { | |
| 68 RunTest("core_test.dart", false, false, 0); | |
| 69 } | |
| 70 | |
| 71 TEST_F(DartUnitTest, core_types_test) { | |
| 72 RunTest("core_types_test.dart", false, false, 0); | |
| 73 } | |
| 74 | |
| 75 TEST_F(DartUnitTest, exception_test) { | |
| 76 RunTest("exception_test.dart", false, false, 0); | |
| 77 } | |
| 78 | |
| 79 TEST_F(DartUnitTest, handle_finalizer_test) { | |
| 80 RunTest("handle_finalizer_test.dart", false, true, 1); | |
| 81 } | |
| 82 | |
| 83 TEST_F(DartUnitTest, hello_mojo) { | |
| 84 RunTest("hello_mojo.dart", false, false, 0); | |
| 85 } | |
| 86 | |
| 87 TEST_F(DartUnitTest, isolate_test) { | |
| 88 RunTest("isolate_test.dart", false, false, 0); | |
| 89 } | |
| 90 | |
| 91 TEST_F(DartUnitTest, import_mojo) { | |
| 92 RunTest("import_mojo.dart", false, false, 0); | |
| 93 } | |
| 94 | |
| 95 TEST_F(DartUnitTest, ping_pong_test) { | |
| 96 RunTest("ping_pong_test.dart", false, false, 0); | |
| 97 } | |
| 98 | |
| 99 TEST_F(DartUnitTest, simple_handle_watcher_test) { | |
| 100 RunTest("simple_handle_watcher_test.dart", false, false, 0); | |
| 101 } | |
| 102 | |
| 103 TEST_F(DartUnitTest, timer_test) { | |
| 104 RunTest("timer_test.dart", false, false, 0); | |
| 105 } | |
| 106 | |
| 107 TEST_F(DartUnitTest, unhandled_exception_test) { | |
| 108 RunTest("unhandled_exception_test.dart", false, true, 2); | |
| 109 } | |
| 110 | |
| 111 TEST_F(DartUnitTest, uri_base_test) { | |
| 112 RunTest("uri_base_test.dart", false, false, 0); | |
| 113 } | |
| 114 | |
| 115 } // namespace | |
| 116 } // namespace dart | |
| 117 } // namespace mojo | |
| OLD | NEW |