| 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 "apps/app_shim/app_shim_handler_mac.h" | 5 #include "apps/app_shim/app_shim_handler_mac.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "chrome/browser/ui/app_list/app_list_service.h" | 7 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/common/mac/app_mode_common.h" | 10 #include "chrome/common/mac/app_mode_common.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 DCHECK(running_); | 33 DCHECK(running_); |
| 34 AppShimHandler::GetForAppMode(app_mode::kAppListModeId)->OnShimFocus(this); | 34 AppShimHandler::GetForAppMode(app_mode::kAppListModeId)->OnShimFocus(this); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void QuitShim() { | 37 void QuitShim() { |
| 38 DCHECK(running_); | 38 DCHECK(running_); |
| 39 running_ = false; | 39 running_ = false; |
| 40 AppShimHandler::GetForAppMode(app_mode::kAppListModeId)->OnShimClose(this); | 40 AppShimHandler::GetForAppMode(app_mode::kAppListModeId)->OnShimClose(this); |
| 41 } | 41 } |
| 42 | 42 |
| 43 // AppShimHandler::Host override: | 43 // AppShimHandler::Host overrides: |
| 44 virtual void OnAppClosed() OVERRIDE { | 44 virtual void OnAppClosed() OVERRIDE { |
| 45 ++close_count_; | 45 ++close_count_; |
| 46 QuitShim(); | 46 QuitShim(); |
| 47 } | 47 } |
| 48 virtual Profile* GetProfile() const OVERRIDE { |
| 49 return NULL; // Currently unused in this test. |
| 50 } |
| 51 virtual std::string GetAppId() const OVERRIDE { |
| 52 return app_mode::kAppListModeId; |
| 53 } |
| 48 | 54 |
| 49 int close_count_; | 55 int close_count_; |
| 50 bool running_; | 56 bool running_; |
| 51 | 57 |
| 52 private: | 58 private: |
| 53 DISALLOW_COPY_AND_ASSIGN(AppListServiceMacBrowserTest); | 59 DISALLOW_COPY_AND_ASSIGN(AppListServiceMacBrowserTest); |
| 54 }; | 60 }; |
| 55 | 61 |
| 56 } // namespace | 62 } // namespace |
| 57 | 63 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 EXPECT_EQ(2, close_count_); | 105 EXPECT_EQ(2, close_count_); |
| 100 | 106 |
| 101 // Verify that observers are correctly removed by ensuring that |close_count_| | 107 // Verify that observers are correctly removed by ensuring that |close_count_| |
| 102 // is unchanged when the app list is dismissed again. | 108 // is unchanged when the app list is dismissed again. |
| 103 service->ShowAppList(browser()->profile()); | 109 service->ShowAppList(browser()->profile()); |
| 104 EXPECT_TRUE(service->IsAppListVisible()); | 110 EXPECT_TRUE(service->IsAppListVisible()); |
| 105 service->DismissAppList(); | 111 service->DismissAppList(); |
| 106 EXPECT_FALSE(service->IsAppListVisible()); | 112 EXPECT_FALSE(service->IsAppListVisible()); |
| 107 EXPECT_EQ(2, close_count_); | 113 EXPECT_EQ(2, close_count_); |
| 108 } | 114 } |
| OLD | NEW |