Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: shell/shell_test_base_android.cc

Issue 815993004: Run shell tests on android. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Add missing file. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 {
20 JNIEnv* InitEnv() {
21 JNIEnv* env = base::android::AttachCurrentThread();
22 static bool inited = false;
23 if (!inited) {
24 RegisterNativesImpl(env);
25 inited = true;
26 }
27 return env;
28 }
29 }
30
31 void ShellTestBase::SetUpTestApplications() {
32 // Extract mojo application, and set the resolve base URL to the directory
ppi 2014/12/22 12:02:25 s/application/applications/
qsr 2014/12/22 12:44:20 Done.
33 // containing those.
34 JNIEnv* env = InitEnv();
35 base::android::ScopedJavaLocalRef<jstring> service_dir(
36 Java_ShellTestBase_extractMojoApplication(
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698