| 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/android/ui_android_jni_registrar.h" | |
| 17 #include "ui/gfx/android/gfx_jni_registrar.h" | |
| 18 #endif | |
| 19 | |
| 20 namespace { | 11 namespace { |
| 21 | 12 |
| 22 class BlimpTestSuite : public base::TestSuite { | 13 class BlimpTestSuite : public base::TestSuite { |
| 23 public: | 14 public: |
| 24 BlimpTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} | 15 BlimpTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} |
| 25 | 16 |
| 26 protected: | |
| 27 void Initialize() override { | |
| 28 base::TestSuite::Initialize(); | |
| 29 | |
| 30 #if defined(OS_ANDROID) | |
| 31 if (!RegisterJni(base::android::AttachCurrentThread())) { | |
| 32 LOG(FATAL) << "Jni Registration failed"; | |
| 33 } | |
| 34 #endif | |
| 35 } | |
| 36 | |
| 37 private: | 17 private: |
| 38 #if defined(OS_ANDROID) | |
| 39 bool RegisterJni(JNIEnv* env) { | |
| 40 if (!base::android::RegisterJni(env)) { | |
| 41 return false; | |
| 42 } | |
| 43 | |
| 44 if (!net::android::RegisterJni(env)) { | |
| 45 return false; | |
| 46 } | |
| 47 | |
| 48 if (!gfx::android::RegisterJni(env)) { | |
| 49 return false; | |
| 50 } | |
| 51 | |
| 52 if (!ui::RegisterUIAndroidJni(env)) { | |
| 53 return false; | |
| 54 } | |
| 55 | |
| 56 if (!blimp::client::RegisterBlimpJni(env)) { | |
| 57 return false; | |
| 58 } | |
| 59 | |
| 60 return true; | |
| 61 } | |
| 62 #endif | |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(BlimpTestSuite); | 18 DISALLOW_COPY_AND_ASSIGN(BlimpTestSuite); |
| 65 }; | 19 }; |
| 66 | 20 |
| 67 } // namespace | 21 } // namespace |
| 68 | 22 |
| 69 int main(int argc, char** argv) { | 23 int main(int argc, char** argv) { |
| 70 mojo::edk::Init(); | 24 mojo::edk::Init(); |
| 71 BlimpTestSuite test_suite(argc, argv); | 25 BlimpTestSuite test_suite(argc, argv); |
| 72 return base::LaunchUnitTests( | 26 return base::LaunchUnitTests( |
| 73 argc, argv, | 27 argc, argv, |
| 74 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); | 28 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); |
| 75 } | 29 } |
| OLD | NEW |