OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test/launcher/unit_test_launcher.h" | 6 #include "base/test/launcher/unit_test_launcher.h" |
7 #include "base/test/test_suite.h" | 7 #include "base/test/test_suite.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "mojo/edk/embedder/embedder.h" | 9 #include "mojo/edk/embedder/embedder.h" |
10 | 10 |
11 #if defined(OS_ANDROID) | |
12 #include "base/android/base_jni_registrar.h" | |
13 #include "base/android/jni_android.h" | |
14 #include "blimp/client/public/android/blimp_jni_registrar.h" | |
15 #include "net/android/net_jni_registrar.h" | |
16 #include "ui/gfx/android/gfx_jni_registrar.h" | |
17 #endif | |
18 | |
19 namespace { | |
20 | |
21 class BlimpTestSuite : public base::TestSuite { | |
22 public: | |
23 BlimpTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} | |
24 | |
25 protected: | |
26 void Initialize() override { | |
27 base::TestSuite::Initialize(); | |
28 | |
29 #if defined(OS_ANDROID) | |
30 if (!RegisterJni(base::android::AttachCurrentThread())) { | |
31 LOG(FATAL) << "Jni Registration failed"; | |
32 } | |
33 #endif | |
34 } | |
35 | |
36 private: | |
37 #if defined(OS_ANDROID) | |
38 bool RegisterJni(JNIEnv* env) { | |
39 if (!base::android::RegisterJni(env)) | |
nyquist
2016/08/16 23:14:57
Nit: I've been told we "always" use curlies in bli
Khushal
2016/08/18 03:16:32
Done.
| |
40 return false; | |
41 | |
42 if (!net::android::RegisterJni(env)) | |
43 return false; | |
44 | |
45 if (!gfx::android::RegisterJni(env)) | |
46 return false; | |
47 | |
48 if (!blimp::client::RegisterBlimpJni(env)) | |
49 return false; | |
50 | |
51 return true; | |
52 } | |
53 #endif | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(BlimpTestSuite); | |
56 }; | |
57 | |
58 } // namespace | |
59 | |
11 int main(int argc, char** argv) { | 60 int main(int argc, char** argv) { |
12 mojo::edk::Init(); | 61 mojo::edk::Init(); |
13 base::TestSuite test_suite(argc, argv); | 62 BlimpTestSuite test_suite(argc, argv); |
63 | |
14 return base::LaunchUnitTests( | 64 return base::LaunchUnitTests( |
15 argc, argv, | 65 argc, argv, |
16 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); | 66 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); |
17 } | 67 } |
OLD | NEW |