Chromium Code Reviews| 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 "shell/shell_test_base.h" | |
| 6 | |
| 7 #include "base/android/jni_android.h" | |
| 8 #include "base/android/jni_string.h" | |
| 9 #include "base/files/file_path.h" | |
| 10 #include "base/files/file_util.h" | |
| 11 #include "jni/ShellTestBase_jni.h" | |
| 12 #include "shell/filename_util.h" | |
| 13 #include "url/gurl.h" | |
| 14 | |
| 15 namespace mojo { | |
| 16 namespace shell { | |
| 17 namespace test { | |
| 18 | |
| 19 namespace { | |
|
viettrungluu
2014/12/22 17:52:39
nit: blank line after
qsr
2014/12/23 09:39:07
Done.
| |
| 20 JNIEnv* InitEnv() { | |
| 21 JNIEnv* env = base::android::AttachCurrentThread(); | |
| 22 static bool inited = false; | |
|
viettrungluu
2014/12/22 17:52:39
nit: I think you should just call it "initialized"
| |
| 23 if (!inited) { | |
| 24 RegisterNativesImpl(env); | |
| 25 inited = true; | |
| 26 } | |
| 27 return env; | |
| 28 } | |
| 29 } | |
|
viettrungluu
2014/12/22 17:52:39
nit: blank line before, and "// namespace" comment
qsr
2014/12/23 09:39:07
Done.
| |
| 30 | |
| 31 void ShellTestBase::SetUpTestApplications() { | |
| 32 // Extract mojo applications, and set the resolve base URL to the directory | |
| 33 // containing those. | |
| 34 JNIEnv* env = InitEnv(); | |
| 35 base::android::ScopedJavaLocalRef<jstring> service_dir( | |
| 36 Java_ShellTestBase_extractMojoApplications( | |
| 37 env, base::android::GetApplicationContext())); | |
| 38 shell_context_.mojo_url_resolver()->SetBaseURL( | |
| 39 FilePathToFileURL(base::FilePath( | |
| 40 base::android::ConvertJavaStringToUTF8(env, service_dir.obj())))); | |
| 41 } | |
| 42 | |
| 43 } // namespace test | |
| 44 } // namespace shell | |
| 45 } // namespace mojo | |
| OLD | NEW |