diff options
author | tapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-26 16:58:50 +0000 |
---|---|---|
committer | tapted@chromium.org <tapted@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-26 16:58:50 +0000 |
commit | 694179b0250d6a690cf878b343f1668e81d9d6fd (patch) | |
tree | e21b54cbc1abee676b7137cda381a0af1fc43134 /apps/app_shim/test | |
parent | ab2b8c100624bd9c575967b8b8d42653dbf0d2cc (diff) | |
download | chromium_src-694179b0250d6a690cf878b343f1668e81d9d6fd.zip chromium_src-694179b0250d6a690cf878b343f1668e81d9d6fd.tar.gz chromium_src-694179b0250d6a690cf878b343f1668e81d9d6fd.tar.bz2 |
Initial integration tests for the App Shim domain socket and IPC.
Integration testing for the app shim socket is difficult in
browser_tests because the nested temp dirs used by test swarming make a
deep directory hierarchy that exceeds the path limits for UNIX domain
sockets. This limit is only 104 characters because the kernel crams it
into a struct sockaddr_un. See `man 4 unix`.
This CL works around the path length limitation by creating a symlink in
a temporary folder under /tmp. Since app shims only exist on Mac, we
know /tmp will exist since Mac conforms to IEEE standard P1003.2 (POSIX,
part 2) via it's UNIX 03 certification.
Initial tests are added for non-argument "launch" IPC messages, and the
listening socket creation/destruction and error handling. This gives
explicit integration coverage to a range of fixes in the bugs below.
BUG=292566, 272577, 240554, 242941
Review URL: https://codereview.chromium.org/23463011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225467 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps/app_shim/test')
-rw-r--r-- | apps/app_shim/test/app_shim_host_manager_test_api_mac.cc | 30 | ||||
-rw-r--r-- | apps/app_shim/test/app_shim_host_manager_test_api_mac.h | 38 |
2 files changed, 68 insertions, 0 deletions
diff --git a/apps/app_shim/test/app_shim_host_manager_test_api_mac.cc b/apps/app_shim/test/app_shim_host_manager_test_api_mac.cc new file mode 100644 index 0000000..2bd83fd --- /dev/null +++ b/apps/app_shim/test/app_shim_host_manager_test_api_mac.cc @@ -0,0 +1,30 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "apps/app_shim/test/app_shim_host_manager_test_api_mac.h" + +#include "apps/app_shim/app_shim_host_manager_mac.h" +#include "base/files/file_path.h" + +namespace test { + +// static +void AppShimHostManagerTestApi::OverrideUserDataDir( + const base::FilePath& user_data_dir) { + CR_DEFINE_STATIC_LOCAL(base::FilePath, override_user_data_dir, ()); + override_user_data_dir = user_data_dir; + AppShimHostManager::g_override_user_data_dir_ = &override_user_data_dir; +} + +AppShimHostManagerTestApi::AppShimHostManagerTestApi( + AppShimHostManager* host_manager) + : host_manager_(host_manager) { + DCHECK(host_manager_); +} + +IPC::ChannelFactory* AppShimHostManagerTestApi::factory() { + return host_manager_->factory_.get(); +} + +} // namespace test diff --git a/apps/app_shim/test/app_shim_host_manager_test_api_mac.h b/apps/app_shim/test/app_shim_host_manager_test_api_mac.h new file mode 100644 index 0000000..dde8782 --- /dev/null +++ b/apps/app_shim/test/app_shim_host_manager_test_api_mac.h @@ -0,0 +1,38 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef APPS_APP_SHIM_TEST_APP_SHIM_HOST_MANAGER_TEST_API_MAC_H +#define APPS_APP_SHIM_TEST_APP_SHIM_HOST_MANAGER_TEST_API_MAC_H + +#include "base/basictypes.h" + +class AppShimHostManager; + +namespace base { +class FilePath; +} + +namespace IPC { +class ChannelFactory; +} + +namespace test { + +class AppShimHostManagerTestApi { + public: + static void OverrideUserDataDir(const base::FilePath& user_data_dir); + + explicit AppShimHostManagerTestApi(AppShimHostManager* host_manager); + + IPC::ChannelFactory* factory(); + + private: + AppShimHostManager* host_manager_; // Not owned. + + DISALLOW_COPY_AND_ASSIGN(AppShimHostManagerTestApi); +}; + +} // namespace test + +#endif // APPS_APP_SHIM_TEST_APP_SHIM_HOST_MANAGER_TEST_API_MAC_H |