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

Side by Side Diff: chrome/browser/apps/app_shim/app_shim_host_manager_browsertest_mac.mm

Issue 2295063002: Use ChannelMojo between app shims and the browser process. (Closed)
Patch Set: Created 4 years, 3 months 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h" 5 #include "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h" 13 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h"
14 #include "chrome/browser/apps/app_shim/test/app_shim_host_manager_test_api_mac.h " 14 #include "chrome/browser/apps/app_shim/test/app_shim_host_manager_test_api_mac.h "
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
19 #include "chrome/common/mac/app_mode_common.h" 19 #include "chrome/common/mac/app_mode_common.h"
20 #include "chrome/common/mac/app_shim_messages.h" 20 #include "chrome/common/mac/app_shim_messages.h"
21 #include "chrome/test/base/in_process_browser_test.h" 21 #include "chrome/test/base/in_process_browser_test.h"
22 #include "components/version_info/version_info.h" 22 #include "components/version_info/version_info.h"
23 #include "content/public/test/test_utils.h" 23 #include "content/public/test/test_utils.h"
24 #include "ipc/ipc_channel_mojo.h"
24 #include "ipc/ipc_channel_proxy.h" 25 #include "ipc/ipc_channel_proxy.h"
25 #include "ipc/ipc_listener.h" 26 #include "ipc/ipc_listener.h"
26 #include "ipc/ipc_message.h" 27 #include "ipc/ipc_message.h"
28 #include "mojo/edk/embedder/embedder.h"
29 #include "mojo/edk/embedder/named_platform_handle_utils.h"
27 30
28 namespace { 31 namespace {
29 32
30 const char kTestAppMode[] = "test_app"; 33 const char kTestAppMode[] = "test_app";
31 34
32 // A test version of the AppShimController IPC client in chrome_main_app_mode. 35 // A test version of the AppShimController IPC client in chrome_main_app_mode.
33 class TestShimClient : public IPC::Listener { 36 class TestShimClient : public IPC::Listener {
34 public: 37 public:
35 TestShimClient(); 38 TestShimClient();
36 ~TestShimClient() override; 39 ~TestShimClient() override;
(...skipping 21 matching lines...) Expand all
58 61
59 base::FilePath user_data_dir; 62 base::FilePath user_data_dir;
60 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); 63 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir));
61 base::FilePath symlink_path = 64 base::FilePath symlink_path =
62 user_data_dir.Append(app_mode::kAppShimSocketSymlinkName); 65 user_data_dir.Append(app_mode::kAppShimSocketSymlinkName);
63 66
64 base::FilePath socket_path; 67 base::FilePath socket_path;
65 CHECK(base::ReadSymbolicLink(symlink_path, &socket_path)); 68 CHECK(base::ReadSymbolicLink(symlink_path, &socket_path));
66 app_mode::VerifySocketPermissions(socket_path); 69 app_mode::VerifySocketPermissions(socket_path);
67 70
68 IPC::ChannelHandle handle(socket_path.value()); 71 channel_ = IPC::ChannelProxy::Create(
69 channel_ = IPC::ChannelProxy::Create(handle, IPC::Channel::MODE_NAMED_CLIENT, 72 IPC::ChannelMojo::CreateClientFactory(
70 this, io_thread_.task_runner().get()); 73 mojo::edk::ConnectToPeerProcess(mojo::edk::CreateClientHandle(
74 mojo::edk::NamedPlatformHandle(socket_path.value()))),
75 io_thread_.task_runner().get()),
76 this, io_thread_.task_runner().get());
71 } 77 }
72 78
73 TestShimClient::~TestShimClient() {} 79 TestShimClient::~TestShimClient() {}
74 80
75 bool TestShimClient::OnMessageReceived(const IPC::Message& message) { 81 bool TestShimClient::OnMessageReceived(const IPC::Message& message) {
76 return true; 82 return true;
77 } 83 }
78 84
79 void TestShimClient::OnChannelError() { 85 void TestShimClient::OnChannelError() {
80 // Client should not get any channel errors for the current set of tests. 86 // Client should not get any channel errors for the current set of tests.
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 ASSERT_TRUE(base::ReadSymbolicLink(symlink_path_, &socket_path)); 284 ASSERT_TRUE(base::ReadSymbolicLink(symlink_path_, &socket_path));
279 EXPECT_EQ(app_mode::kAppShimSocketShortName, socket_path.BaseName().value()); 285 EXPECT_EQ(app_mode::kAppShimSocketShortName, socket_path.BaseName().value());
280 286
281 // Check that the RunningChromeVersion file is correctly written. 287 // Check that the RunningChromeVersion file is correctly written.
282 base::FilePath version; 288 base::FilePath version;
283 EXPECT_TRUE(base::ReadSymbolicLink(version_path_, &version)); 289 EXPECT_TRUE(base::ReadSymbolicLink(version_path_, &version));
284 EXPECT_EQ(version_info::GetVersionNumber(), version.value()); 290 EXPECT_EQ(version_info::GetVersionNumber(), version.value());
285 } 291 }
286 292
287 } // namespace 293 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/apps/app_shim/app_shim_host_mac.cc ('k') | chrome/browser/apps/app_shim/app_shim_host_manager_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698