Chromium Code Reviews| Index: apps/app_shim/app_shim_host_manager_browsertest_mac.mm |
| diff --git a/apps/app_shim/app_shim_host_manager_browsertest_mac.mm b/apps/app_shim/app_shim_host_manager_browsertest_mac.mm |
| index bf325cc9ff68d65d0422152205fb1895e53073ce..4fb420fd4afd2a3c40690c904dbe128203c622e3 100644 |
| --- a/apps/app_shim/app_shim_host_manager_browsertest_mac.mm |
| +++ b/apps/app_shim/app_shim_host_manager_browsertest_mac.mm |
| @@ -29,7 +29,7 @@ const char kTestAppMode[] = "test_app"; |
| // A test version of the AppShimController IPC client in chrome_main_app_mode. |
| class TestShimClient : public IPC::Listener { |
| public: |
| - TestShimClient(const base::FilePath& socket_path); |
| + TestShimClient(); |
| virtual ~TestShimClient(); |
| template <class T> |
| @@ -48,12 +48,17 @@ class TestShimClient : public IPC::Listener { |
| DISALLOW_COPY_AND_ASSIGN(TestShimClient); |
| }; |
| -TestShimClient::TestShimClient(const base::FilePath& socket_path) |
| +TestShimClient::TestShimClient() |
| : io_thread_("TestShimClientIO") { |
| base::Thread::Options io_thread_options; |
| io_thread_options.message_loop_type = base::MessageLoop::TYPE_IO; |
| io_thread_.StartWithOptions(io_thread_options); |
| + base::FilePath socket_path; |
| + PathService::Get(chrome::DIR_USER_DATA, &socket_path); |
|
tapted
2013/11/21 11:12:05
nit: check return value
jackhou1
2013/11/22 00:20:40
Done.
|
| + socket_path = socket_path.Append(app_mode::kAppShimSocketName); |
|
tapted
2013/11/21 11:12:05
should this be part of GetShortSocketPath?
Then i
jackhou1
2013/11/22 00:20:40
Changed it so that GetShortSocketPath takes the us
|
| + socket_path = app_mode::GetShortSocketPath(socket_path); |
| + |
| IPC::ChannelHandle handle(socket_path.value()); |
| channel_.reset(new IPC::ChannelProxy(handle, IPC::Channel::MODE_NAMED_CLIENT, |
| this, io_thread_.message_loop_proxy().get())); |
| @@ -83,9 +88,6 @@ class AppShimHostManagerBrowserTest : public InProcessBrowserTest, |
| // test launch behavior. |
| void RunAndExitGracefully(); |
| - // InProcessBrowserTest overrides: |
| - virtual bool SetUpUserDataDirectory() OVERRIDE; |
| - |
| // AppShimHandler overrides: |
| virtual void OnShimLaunch(apps::AppShimHandler::Host* host, |
| apps::AppShimLaunchType launch_type, |
| @@ -99,7 +101,6 @@ class AppShimHostManagerBrowserTest : public InProcessBrowserTest, |
| virtual void OnShimQuit(apps::AppShimHandler::Host* host) OVERRIDE; |
| scoped_ptr<TestShimClient> test_client_; |
| - base::FilePath short_socket_path_; |
| std::vector<base::FilePath> last_launch_files_; |
| apps::AppShimLaunchType last_launch_type_; |
| @@ -139,26 +140,6 @@ void AppShimHostManagerBrowserTest::RunAndExitGracefully() { |
| test_client_.reset(); |
| } |
| -bool AppShimHostManagerBrowserTest::SetUpUserDataDirectory() { |
| - // Create a symlink at /tmp/scoped_dir_XXXXXX/udd that points to the real user |
| - // data dir, and use this as the domain socket path. This is required because |
| - // there is a path length limit for named sockets that is exceeded in |
| - // multi-process test spawning. |
| - base::FilePath real_user_data_dir; |
| - EXPECT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &real_user_data_dir)); |
| - EXPECT_TRUE( |
| - short_temp_dir_.CreateUniqueTempDirUnderPath(base::FilePath("/tmp"))); |
| - base::FilePath shortened_user_data_dir = short_temp_dir_.path().Append("udd"); |
| - EXPECT_EQ(0, ::symlink(real_user_data_dir.AsUTF8Unsafe().c_str(), |
| - shortened_user_data_dir.AsUTF8Unsafe().c_str())); |
| - |
| - test::AppShimHostManagerTestApi::OverrideUserDataDir(shortened_user_data_dir); |
| - short_socket_path_ = |
| - shortened_user_data_dir.Append(app_mode::kAppShimSocketName); |
| - |
| - return InProcessBrowserTest::SetUpUserDataDirectory(); |
| -} |
| - |
| void AppShimHostManagerBrowserTest::OnShimLaunch( |
| apps::AppShimHandler::Host* host, |
| apps::AppShimLaunchType launch_type, |
| @@ -178,7 +159,7 @@ void AppShimHostManagerBrowserTest::OnShimQuit( |
| // Test regular launch, which would ask Chrome to launch the app. |
| IN_PROC_BROWSER_TEST_F(AppShimHostManagerBrowserTest, LaunchNormal) { |
| - test_client_.reset(new TestShimClient(short_socket_path_)); |
| + test_client_.reset(new TestShimClient()); |
| test_client_->Send(new AppShimHostMsg_LaunchApp( |
| browser()->profile()->GetPath(), |
| kTestAppMode, |
| @@ -192,7 +173,7 @@ IN_PROC_BROWSER_TEST_F(AppShimHostManagerBrowserTest, LaunchNormal) { |
| // Test register-only launch, used when Chrome has already launched the app. |
| IN_PROC_BROWSER_TEST_F(AppShimHostManagerBrowserTest, LaunchRegisterOnly) { |
| - test_client_.reset(new TestShimClient(short_socket_path_)); |
| + test_client_.reset(new TestShimClient()); |
| test_client_->Send(new AppShimHostMsg_LaunchApp( |
| browser()->profile()->GetPath(), |
| kTestAppMode, |
| @@ -244,9 +225,10 @@ bool AppShimHostManagerBrowserTestFailsCreate::SetUpUserDataDirectory() { |
| EXPECT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); |
| base::FilePath socket_path = |
| user_data_dir.Append(app_mode::kAppShimSocketName); |
| + socket_path = app_mode::GetShortSocketPath(socket_path); |
| // Create a "barrier" to forming the UNIX domain socket. This is just a |
| // pre-existing directory which can not be unlink()ed, in order to place a |
| - // named socked there instead. |
| + // named socket there instead. |
| EXPECT_TRUE(barrier_dir_.Set(socket_path)); |
| return AppShimHostManagerBrowserTest::SetUpUserDataDirectory(); |
| } |