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

Unified Diff: apps/app_shim/app_shim_host_mac_unittest.cc

Issue 15269003: Refactor extension handling code from AppShimHost into ExtensionAppShimHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « apps/app_shim/app_shim_host_mac.cc ('k') | apps/app_shim/app_shim_host_manager_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/app_shim/app_shim_host_mac_unittest.cc
diff --git a/apps/app_shim/app_shim_host_mac_unittest.cc b/apps/app_shim/app_shim_host_mac_unittest.cc
index 476b2ceb43748126aa5fe940e232f1c119215184..f9a8e4dcc775b8a5c9d9986335ca1db089bd2b1e 100644
--- a/apps/app_shim/app_shim_host_mac_unittest.cc
+++ b/apps/app_shim/app_shim_host_mac_unittest.cc
@@ -5,6 +5,7 @@
#include "apps/app_shim/app_shim_host_mac.h"
#include "apps/app_shim/app_shim_messages.h"
+#include "base/basictypes.h"
#include "base/memory/scoped_vector.h"
#include "chrome/test/base/testing_profile.h"
#include "ipc/ipc_message.h"
@@ -31,18 +32,9 @@ class TestingAppShimHost : public AppShimHost {
fails_launch_ = fails_launch;
}
- const std::string& GetAppId() const {
- return app_id();
- }
-
- const Profile* GetProfile() const {
- return profile();
- }
-
protected:
virtual Profile* FetchProfileForDirectory(const std::string& profile_dir)
OVERRIDE;
- virtual bool LaunchApp(Profile* profile) OVERRIDE;
virtual bool Send(IPC::Message* message) OVERRIDE;
private:
@@ -77,10 +69,6 @@ Profile* TestingAppShimHost::FetchProfileForDirectory(
return fails_profile_ ? NULL : test_profile_;
}
-bool TestingAppShimHost::LaunchApp(Profile* profile) {
- return !fails_launch_;
-}
-
class AppShimHostTest : public testing::Test,
public apps::AppShimHandler {
public:
@@ -117,6 +105,7 @@ class AppShimHostTest : public testing::Test,
private:
virtual void SetUp() OVERRIDE {
+ testing::Test::SetUp();
profile_.reset(new TestingProfile);
host_.reset(new TestingAppShimHost(profile()));
}
@@ -132,19 +121,12 @@ const char kTestProfileDir[] = "Default";
} // namespace
-TEST_F(AppShimHostTest, TestLaunchApp) {
- host()->ReceiveMessage(
- new AppShimHostMsg_LaunchApp(kTestProfileDir, kTestAppId));
- ASSERT_EQ(kTestAppId, host()->GetAppId());
- ASSERT_EQ(profile(), host()->GetProfile());
- ASSERT_TRUE(LaunchWasSuccessful());
-}
-
TEST_F(AppShimHostTest, TestLaunchAppWithHandler) {
apps::AppShimHandler::RegisterHandler(kTestAppId, this);
EXPECT_TRUE(host()->ReceiveMessage(
new AppShimHostMsg_LaunchApp(kTestProfileDir, kTestAppId)));
- EXPECT_EQ(kTestAppId, host()->GetAppId());
+ EXPECT_EQ(kTestAppId,
+ implicit_cast<apps::AppShimHandler::Host*>(host())->GetAppId());
EXPECT_TRUE(LaunchWasSuccessful());
EXPECT_EQ(1, launch_count_);
EXPECT_EQ(0, focus_count_);
« no previous file with comments | « apps/app_shim/app_shim_host_mac.cc ('k') | apps/app_shim/app_shim_host_manager_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698