summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn2
-rw-r--r--components/filesystem/BUILD.gn22
-rw-r--r--components/filesystem/apptest_manifest.json5
-rw-r--r--components/filesystem/files_test_base.cc4
-rw-r--r--components/filesystem/files_test_base.h6
-rw-r--r--components/filesystem/test_manifest.json5
-rw-r--r--mojo/shell/public/cpp/lib/shell_test.cc12
-rw-r--r--mojo/shell/public/cpp/shell_test.h2
-rw-r--r--mojo/tools/data/apptests4
-rw-r--r--testing/buildbot/chromium.linux.json6
-rw-r--r--testing/buildbot/gn_isolate_map.pyl4
11 files changed, 47 insertions, 25 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 472c12e..90ed46d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -589,7 +589,6 @@ group("mojo_apptests") {
if (is_win || is_linux) {
deps += [
- "//components/filesystem:apptests",
"//components/leveldb:apptests",
"//components/resource_provider:apptests",
"//components/resource_provider:resource_provider_unittests",
@@ -639,6 +638,7 @@ group("gn_only") {
"//chrome/installer/util:strings",
"//chrome/tools/convert_dict",
"//components/constrained_window:unit_tests",
+ "//components/filesystem:unittests",
"//components/metrics:serialization",
"//components/password_manager/content/renderer:browser_tests",
"//components/rappor:unit_tests",
diff --git a/components/filesystem/BUILD.gn b/components/filesystem/BUILD.gn
index e09c166..e941f31 100644
--- a/components/filesystem/BUILD.gn
+++ b/components/filesystem/BUILD.gn
@@ -4,6 +4,7 @@
import("//mojo/public/mojo_application.gni")
import("//mojo/public/mojo_application_manifest.gni")
+import("//testing/test.gni")
source_set("lib") {
sources = [
@@ -60,10 +61,8 @@ mojo_application_manifest("manifest") {
source = "manifest.json"
}
-mojo_native_application("apptests") {
- output_name = "filesystem_apptests"
-
- testonly = true
+test("unittests") {
+ output_name = "filesystem_service_unittests"
sources = [
"directory_impl_unittest.cc",
@@ -76,18 +75,21 @@ mojo_native_application("apptests") {
"//base",
"//components/filesystem/public/interfaces",
"//mojo/common",
- "//mojo/platform_handle:for_shared_library",
+ "//mojo/platform_handle",
"//mojo/public/cpp/bindings",
- "//mojo/shell/public/cpp:test_support",
+ "//mojo/shell/public/cpp:shell_test_support",
+ "//mojo/shell/public/cpp:sources",
+ "//mojo/shell/public/cpp/test:run_all_shelltests",
]
data_deps = [
- ":apptest_manifest",
+ ":test_manifest",
":filesystem",
]
}
-mojo_application_manifest("apptest_manifest") {
- application_name = "filesystem_apptests"
- source = "apptest_manifest.json"
+mojo_application_manifest("test_manifest") {
+ type = "exe"
+ application_name = "filesystem_service_unittests"
+ source = "test_manifest.json"
}
diff --git a/components/filesystem/apptest_manifest.json b/components/filesystem/apptest_manifest.json
deleted file mode 100644
index 43a8f79..0000000
--- a/components/filesystem/apptest_manifest.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "name": "mojo:filesystem_apptests",
- "display_name": "File System Service Apptests",
- "capabilities": { "*": [ "*" ] }
-}
diff --git a/components/filesystem/files_test_base.cc b/components/filesystem/files_test_base.cc
index 15399c3..08ff0ed 100644
--- a/components/filesystem/files_test_base.cc
+++ b/components/filesystem/files_test_base.cc
@@ -13,14 +13,14 @@
namespace filesystem {
-FilesTestBase::FilesTestBase() {
+FilesTestBase::FilesTestBase() : ShellTest("exe:filesystem_service_unittests") {
}
FilesTestBase::~FilesTestBase() {
}
void FilesTestBase::SetUp() {
- ApplicationTestBase::SetUp();
+ ShellTest::SetUp();
connector()->ConnectToInterface("mojo:filesystem", &files_);
}
diff --git a/components/filesystem/files_test_base.h b/components/filesystem/files_test_base.h
index 8ce96c0..e3d2a63 100644
--- a/components/filesystem/files_test_base.h
+++ b/components/filesystem/files_test_base.h
@@ -8,16 +8,16 @@
#include "base/macros.h"
#include "components/filesystem/public/interfaces/file_system.mojom.h"
#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/shell/public/cpp/application_test_base.h"
+#include "mojo/shell/public/cpp/shell_test.h"
namespace filesystem {
-class FilesTestBase : public mojo::test::ApplicationTestBase {
+class FilesTestBase : public mojo::test::ShellTest {
public:
FilesTestBase();
~FilesTestBase() override;
- // Overridden from mojo::test::ApplicationTestBase:
+ // Overridden from mojo::test::ShellTest:
void SetUp() override;
protected:
diff --git a/components/filesystem/test_manifest.json b/components/filesystem/test_manifest.json
new file mode 100644
index 0000000..ef30998
--- /dev/null
+++ b/components/filesystem/test_manifest.json
@@ -0,0 +1,5 @@
+{
+ "name": "exe:filesystem_service_unittests",
+ "display_name": "Filesystem Service Unittests",
+ "capabilities": { "*": [ "*" ] }
+}
diff --git a/mojo/shell/public/cpp/lib/shell_test.cc b/mojo/shell/public/cpp/lib/shell_test.cc
index e5cb3c2..605e7c5 100644
--- a/mojo/shell/public/cpp/lib/shell_test.cc
+++ b/mojo/shell/public/cpp/lib/shell_test.cc
@@ -5,6 +5,7 @@
#include "mojo/shell/public/cpp/shell_test.h"
#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
#include "mojo/shell/background/background_shell.h"
#include "mojo/shell/public/cpp/shell_client.h"
@@ -44,6 +45,7 @@ void ShellTest::InitializeCalled(Connector* connector,
initialize_name_ = name;
initialize_instance_id_ = id;
initialize_userid_ = user_id;
+ initialize_called_.Run();
}
void ShellTest::SetUp() {
@@ -51,10 +53,20 @@ void ShellTest::SetUp() {
message_loop_ = CreateMessageLoop();
background_shell_.reset(new shell::BackgroundShell);
background_shell_->Init(nullptr);
+
+ // Create the shell connection. We don't proceed until we get our
+ // ShellClient's Initialize() method is called.
+ base::RunLoop run_loop;
+ base::MessageLoop::ScopedNestableTaskAllower allow(
+ base::MessageLoop::current());
+ initialize_called_ = run_loop.QuitClosure();
+
shell_connection_.reset(new ShellConnection(
shell_client_.get(),
background_shell_->CreateShellClientRequest(test_name_)));
connector_ = shell_connection_->connector();
+
+ run_loop.Run();
}
void ShellTest::TearDown() {
diff --git a/mojo/shell/public/cpp/shell_test.h b/mojo/shell/public/cpp/shell_test.h
index ee85d12..3c8e3d8 100644
--- a/mojo/shell/public/cpp/shell_test.h
+++ b/mojo/shell/public/cpp/shell_test.h
@@ -100,6 +100,8 @@ class ShellTest : public testing::Test {
std::string initialize_userid_ = shell::mojom::kInheritUserID;
uint32_t initialize_instance_id_ = shell::mojom::kInvalidInstanceID;
+ base::Closure initialize_called_;
+
DISALLOW_COPY_AND_ASSIGN(ShellTest);
};
diff --git a/mojo/tools/data/apptests b/mojo/tools/data/apptests
index 6ffff1e..8e07e4e 100644
--- a/mojo/tools/data/apptests
+++ b/mojo/tools/data/apptests
@@ -39,10 +39,6 @@ tests = [
if config.target_os != config.OS_ANDROID:
tests += [
{
- 'test': 'mojo:filesystem_apptests',
- 'type': 'gtest_isolated',
- },
- {
'test': 'mojo:mash_wm_apptests',
'type': 'gtest_isolated',
'args': ['--use-x11-test-config',
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json
index 32f26fb..8f9d3e8 100644
--- a/testing/buildbot/chromium.linux.json
+++ b/testing/buildbot/chromium.linux.json
@@ -710,6 +710,9 @@
"test": "extensions_unittests"
},
{
+ "test": "filesystem_service_unittests"
+ },
+ {
"swarming": {
"can_use_on_swarming_builders": true
},
@@ -1144,6 +1147,9 @@
"test": "extensions_unittests"
},
{
+ "test": "filesystem_service_unittests"
+ },
+ {
"swarming": {
"can_use_on_swarming_builders": true
},
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl
index 9288371..efe5c9d 100644
--- a/testing/buildbot/gn_isolate_map.pyl
+++ b/testing/buildbot/gn_isolate_map.pyl
@@ -251,6 +251,10 @@
"label": "//extensions:extensions_unittests",
"type": "windowed_test_launcher",
},
+ "filesystem_service_unittests": {
+ "label": "//components/filesystem:unittests",
+ "type": "console_test_launcher",
+ },
"gcm_unit_tests": {
"label": "//google_apis/gcm:gcm_unit_tests",
"type": "console_test_launcher",