| OLD | NEW |
| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 TestShimClient(); | 33 TestShimClient(); |
| 34 virtual ~TestShimClient(); | 34 virtual ~TestShimClient(); |
| 35 | 35 |
| 36 template <class T> | 36 template <class T> |
| 37 void Send(const T& message) { | 37 void Send(const T& message) { |
| 38 channel_->Send(message); | 38 channel_->Send(message); |
| 39 } | 39 } |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 // IPC::Listener overrides: | 42 // IPC::Listener overrides: |
| 43 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 43 virtual bool OnMessageReceived(const IPC::Message& message) override; |
| 44 virtual void OnChannelError() OVERRIDE; | 44 virtual void OnChannelError() override; |
| 45 | 45 |
| 46 base::Thread io_thread_; | 46 base::Thread io_thread_; |
| 47 scoped_ptr<IPC::ChannelProxy> channel_; | 47 scoped_ptr<IPC::ChannelProxy> channel_; |
| 48 | 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(TestShimClient); | 49 DISALLOW_COPY_AND_ASSIGN(TestShimClient); |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 TestShimClient::TestShimClient() : io_thread_("TestShimClientIO") { | 52 TestShimClient::TestShimClient() : io_thread_("TestShimClientIO") { |
| 53 base::Thread::Options io_thread_options; | 53 base::Thread::Options io_thread_options; |
| 54 io_thread_options.message_loop_type = base::MessageLoop::TYPE_IO; | 54 io_thread_options.message_loop_type = base::MessageLoop::TYPE_IO; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 public: | 88 public: |
| 89 AppShimHostManagerBrowserTest(); | 89 AppShimHostManagerBrowserTest(); |
| 90 virtual ~AppShimHostManagerBrowserTest(); | 90 virtual ~AppShimHostManagerBrowserTest(); |
| 91 | 91 |
| 92 protected: | 92 protected: |
| 93 // Wait for OnShimLaunch, then send a quit, and wait for the response. Used to | 93 // Wait for OnShimLaunch, then send a quit, and wait for the response. Used to |
| 94 // test launch behavior. | 94 // test launch behavior. |
| 95 void RunAndExitGracefully(); | 95 void RunAndExitGracefully(); |
| 96 | 96 |
| 97 // InProcessBrowserTest overrides: | 97 // InProcessBrowserTest overrides: |
| 98 virtual void SetUpOnMainThread() OVERRIDE; | 98 virtual void SetUpOnMainThread() override; |
| 99 virtual void TearDownOnMainThread() OVERRIDE; | 99 virtual void TearDownOnMainThread() override; |
| 100 | 100 |
| 101 // AppShimHandler overrides: | 101 // AppShimHandler overrides: |
| 102 virtual void OnShimLaunch(apps::AppShimHandler::Host* host, | 102 virtual void OnShimLaunch(apps::AppShimHandler::Host* host, |
| 103 apps::AppShimLaunchType launch_type, | 103 apps::AppShimLaunchType launch_type, |
| 104 const std::vector<base::FilePath>& files) OVERRIDE; | 104 const std::vector<base::FilePath>& files) override; |
| 105 virtual void OnShimClose(apps::AppShimHandler::Host* host) OVERRIDE {} | 105 virtual void OnShimClose(apps::AppShimHandler::Host* host) override {} |
| 106 virtual void OnShimFocus(apps::AppShimHandler::Host* host, | 106 virtual void OnShimFocus(apps::AppShimHandler::Host* host, |
| 107 apps::AppShimFocusType focus_type, | 107 apps::AppShimFocusType focus_type, |
| 108 const std::vector<base::FilePath>& files) OVERRIDE {} | 108 const std::vector<base::FilePath>& files) override {} |
| 109 virtual void OnShimSetHidden(apps::AppShimHandler::Host* host, | 109 virtual void OnShimSetHidden(apps::AppShimHandler::Host* host, |
| 110 bool hidden) OVERRIDE {} | 110 bool hidden) override {} |
| 111 virtual void OnShimQuit(apps::AppShimHandler::Host* host) OVERRIDE; | 111 virtual void OnShimQuit(apps::AppShimHandler::Host* host) override; |
| 112 | 112 |
| 113 scoped_ptr<TestShimClient> test_client_; | 113 scoped_ptr<TestShimClient> test_client_; |
| 114 std::vector<base::FilePath> last_launch_files_; | 114 std::vector<base::FilePath> last_launch_files_; |
| 115 apps::AppShimLaunchType last_launch_type_; | 115 apps::AppShimLaunchType last_launch_type_; |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 scoped_refptr<content::MessageLoopRunner> runner_; | 118 scoped_refptr<content::MessageLoopRunner> runner_; |
| 119 | 119 |
| 120 int launch_count_; | 120 int launch_count_; |
| 121 int quit_count_; | 121 int quit_count_; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 : public AppShimHostManagerBrowserTest { | 223 : public AppShimHostManagerBrowserTest { |
| 224 public: | 224 public: |
| 225 AppShimHostManagerBrowserTestSocketFiles() {} | 225 AppShimHostManagerBrowserTestSocketFiles() {} |
| 226 | 226 |
| 227 protected: | 227 protected: |
| 228 base::FilePath directory_in_tmp_; | 228 base::FilePath directory_in_tmp_; |
| 229 base::FilePath symlink_path_; | 229 base::FilePath symlink_path_; |
| 230 base::FilePath version_path_; | 230 base::FilePath version_path_; |
| 231 | 231 |
| 232 private: | 232 private: |
| 233 virtual bool SetUpUserDataDirectory() OVERRIDE; | 233 virtual bool SetUpUserDataDirectory() override; |
| 234 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; | 234 virtual void TearDownInProcessBrowserTestFixture() override; |
| 235 | 235 |
| 236 DISALLOW_COPY_AND_ASSIGN(AppShimHostManagerBrowserTestSocketFiles); | 236 DISALLOW_COPY_AND_ASSIGN(AppShimHostManagerBrowserTestSocketFiles); |
| 237 }; | 237 }; |
| 238 | 238 |
| 239 bool AppShimHostManagerBrowserTestSocketFiles::SetUpUserDataDirectory() { | 239 bool AppShimHostManagerBrowserTestSocketFiles::SetUpUserDataDirectory() { |
| 240 // Create an existing symlink. It should be replaced by AppShimHostManager. | 240 // Create an existing symlink. It should be replaced by AppShimHostManager. |
| 241 base::FilePath user_data_dir; | 241 base::FilePath user_data_dir; |
| 242 EXPECT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); | 242 EXPECT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); |
| 243 symlink_path_ = user_data_dir.Append(app_mode::kAppShimSocketSymlinkName); | 243 symlink_path_ = user_data_dir.Append(app_mode::kAppShimSocketSymlinkName); |
| 244 base::FilePath temp_dir; | 244 base::FilePath temp_dir; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 ASSERT_TRUE(base::ReadSymbolicLink(symlink_path_, &socket_path)); | 278 ASSERT_TRUE(base::ReadSymbolicLink(symlink_path_, &socket_path)); |
| 279 EXPECT_EQ(app_mode::kAppShimSocketShortName, socket_path.BaseName().value()); | 279 EXPECT_EQ(app_mode::kAppShimSocketShortName, socket_path.BaseName().value()); |
| 280 | 280 |
| 281 // Check that the RunningChromeVersion file is correctly written. | 281 // Check that the RunningChromeVersion file is correctly written. |
| 282 base::FilePath version; | 282 base::FilePath version; |
| 283 EXPECT_TRUE(base::ReadSymbolicLink(version_path_, &version)); | 283 EXPECT_TRUE(base::ReadSymbolicLink(version_path_, &version)); |
| 284 EXPECT_EQ(chrome::VersionInfo().Version(), version.value()); | 284 EXPECT_EQ(chrome::VersionInfo().Version(), version.value()); |
| 285 } | 285 } |
| 286 | 286 |
| 287 } // namespace | 287 } // namespace |
| OLD | NEW |