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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 } | 59 } |
60 | 60 |
61 protected: | 61 protected: |
62 Profile* profile2_; | 62 Profile* profile2_; |
63 | 63 |
64 private: | 64 private: |
65 DISALLOW_COPY_AND_ASSIGN(AppListControllerBrowserTest); | 65 DISALLOW_COPY_AND_ASSIGN(AppListControllerBrowserTest); |
66 }; | 66 }; |
67 | 67 |
68 // Test the CreateNewWindow function of the controller delegate. | 68 // Test the CreateNewWindow function of the controller delegate. |
69 // TODO(mgiuca): Enable on Linux when supported. | |
70 #if !defined(OS_LINUX) | |
69 IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, CreateNewWindow) { | 71 IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, CreateNewWindow) { |
70 const chrome::HostDesktopType desktop = chrome::GetActiveDesktop(); | 72 const chrome::HostDesktopType desktop = chrome::GetActiveDesktop(); |
71 AppListService* service = AppListService::Get(); | 73 AppListService* service = AppListService::Get(); |
72 scoped_ptr<AppListControllerDelegate> controller( | 74 scoped_ptr<AppListControllerDelegate> controller( |
73 service->CreateControllerDelegate()); | 75 service->CreateControllerDelegate()); |
74 ASSERT_TRUE(controller); | 76 ASSERT_TRUE(controller); |
75 | 77 |
76 EXPECT_EQ(1U, chrome::GetBrowserCount(browser()->profile(), desktop)); | 78 EXPECT_EQ(1U, chrome::GetBrowserCount(browser()->profile(), desktop)); |
77 EXPECT_EQ(0U, chrome::GetBrowserCount( | 79 EXPECT_EQ(0U, chrome::GetBrowserCount( |
78 browser()->profile()->GetOffTheRecordProfile(), desktop)); | 80 browser()->profile()->GetOffTheRecordProfile(), desktop)); |
79 | 81 |
80 controller->CreateNewWindow(browser()->profile(), false); | 82 controller->CreateNewWindow(browser()->profile(), false); |
81 EXPECT_EQ(2U, chrome::GetBrowserCount(browser()->profile(), desktop)); | 83 EXPECT_EQ(2U, chrome::GetBrowserCount(browser()->profile(), desktop)); |
82 | 84 |
83 controller->CreateNewWindow(browser()->profile(), true); | 85 controller->CreateNewWindow(browser()->profile(), true); |
84 EXPECT_EQ(1U, chrome::GetBrowserCount( | 86 EXPECT_EQ(1U, chrome::GetBrowserCount( |
85 browser()->profile()->GetOffTheRecordProfile(), desktop)); | 87 browser()->profile()->GetOffTheRecordProfile(), desktop)); |
86 } | 88 } |
89 #endif | |
tapted
2013/09/27 06:25:56
nit: ` // !defined(OS_LINUX)`
Matt Giuca
2013/09/27 10:29:41
Done.
| |
87 | 90 |
88 #if !defined(OS_CHROMEOS) | 91 // TODO(mgiuca): Enable on Linux when supported. |
92 #if !defined(OS_CHROMEOS) && !defined(OS_LINUX) | |
89 // Show the app list, then dismiss it. | 93 // Show the app list, then dismiss it. |
90 IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, ShowAndDismiss) { | 94 IN_PROC_BROWSER_TEST_F(AppListControllerBrowserTest, ShowAndDismiss) { |
91 AppListService* service = AppListService::Get(); | 95 AppListService* service = AppListService::Get(); |
92 ASSERT_FALSE(service->IsAppListVisible()); | 96 ASSERT_FALSE(service->IsAppListVisible()); |
93 service->ShowForProfile(browser()->profile()); | 97 service->ShowForProfile(browser()->profile()); |
94 ASSERT_TRUE(service->IsAppListVisible()); | 98 ASSERT_TRUE(service->IsAppListVisible()); |
95 service->DismissAppList(); | 99 service->DismissAppList(); |
96 ASSERT_FALSE(service->IsAppListVisible()); | 100 ASSERT_FALSE(service->IsAppListVisible()); |
97 } | 101 } |
98 | 102 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 // The app list should already be shown because we passed | 191 // The app list should already be shown because we passed |
188 // switches::kShowAppList. | 192 // switches::kShowAppList. |
189 ASSERT_TRUE(service->IsAppListVisible()); | 193 ASSERT_TRUE(service->IsAppListVisible()); |
190 | 194 |
191 // Create a browser to prevent shutdown when we dismiss the app list. We | 195 // Create a browser to prevent shutdown when we dismiss the app list. We |
192 // need to do this because switches::kShowAppList suppresses the creation of | 196 // need to do this because switches::kShowAppList suppresses the creation of |
193 // any browsers. | 197 // any browsers. |
194 CreateBrowser(service->GetCurrentAppListProfile()); | 198 CreateBrowser(service->GetCurrentAppListProfile()); |
195 service->DismissAppList(); | 199 service->DismissAppList(); |
196 } | 200 } |
197 #endif // !defined(OS_CHROMEOS) | 201 #endif // !defined(OS_CHROMEOS) |
tapted
2013/09/27 06:25:56
this should be updated too
Matt Giuca
2013/09/27 10:29:41
Done.
| |
198 | 202 |
199 // Browser Test for AppListController that observes search result changes. | 203 // Browser Test for AppListController that observes search result changes. |
200 class AppListControllerSearchResultsBrowserTest | 204 class AppListControllerSearchResultsBrowserTest |
201 : public ExtensionBrowserTest, | 205 : public ExtensionBrowserTest, |
202 public app_list::SearchResultObserver, | 206 public app_list::SearchResultObserver, |
203 public ui::ListModelObserver { | 207 public ui::ListModelObserver { |
204 public: | 208 public: |
205 AppListControllerSearchResultsBrowserTest() | 209 AppListControllerSearchResultsBrowserTest() |
206 : observed_result_(NULL), | 210 : observed_result_(NULL), |
207 item_uninstall_count_(0), | 211 item_uninstall_count_(0), |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 int item_uninstall_count_; | 270 int item_uninstall_count_; |
267 | 271 |
268 private: | 272 private: |
269 base::string16 item_to_observe_; | 273 base::string16 item_to_observe_; |
270 app_list::AppListModel::SearchResults* observed_results_list_; | 274 app_list::AppListModel::SearchResults* observed_results_list_; |
271 | 275 |
272 DISALLOW_COPY_AND_ASSIGN(AppListControllerSearchResultsBrowserTest); | 276 DISALLOW_COPY_AND_ASSIGN(AppListControllerSearchResultsBrowserTest); |
273 }; | 277 }; |
274 | 278 |
275 // Test showing search results, and uninstalling one of them while displayed. | 279 // Test showing search results, and uninstalling one of them while displayed. |
276 IN_PROC_BROWSER_TEST_F(AppListControllerSearchResultsBrowserTest, | 280 IN_PROC_BROWSER_TEST_F(AppListControllerSearchResultsBrowserTest, |
tapted
2013/09/27 06:25:56
This guy might need to be hidden too
Matt Giuca
2013/09/27 10:29:41
Done.
| |
277 UninstallSearchResult) { | 281 UninstallSearchResult) { |
278 base::FilePath test_extension_path; | 282 base::FilePath test_extension_path; |
279 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_extension_path)); | 283 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_extension_path)); |
280 test_extension_path = test_extension_path.AppendASCII("extensions") | 284 test_extension_path = test_extension_path.AppendASCII("extensions") |
281 .AppendASCII("platform_apps") | 285 .AppendASCII("platform_apps") |
282 .AppendASCII("minimal"); | 286 .AppendASCII("minimal"); |
283 const extensions::Extension* extension = | 287 const extensions::Extension* extension = |
284 InstallExtension(test_extension_path, | 288 InstallExtension(test_extension_path, |
285 1 /* expected_change: new install */); | 289 1 /* expected_change: new install */); |
286 ASSERT_TRUE(extension); | 290 ASSERT_TRUE(extension); |
(...skipping 26 matching lines...) Expand all Loading... | |
313 // Results should not be immediately refreshed. When they are, the item should | 317 // Results should not be immediately refreshed. When they are, the item should |
314 // be removed from the model. | 318 // be removed from the model. |
315 EXPECT_TRUE(observed_result_); | 319 EXPECT_TRUE(observed_result_); |
316 base::RunLoop().RunUntilIdle(); | 320 base::RunLoop().RunUntilIdle(); |
317 EXPECT_FALSE(observed_result_); | 321 EXPECT_FALSE(observed_result_); |
318 StopWatchingResults(); | 322 StopWatchingResults(); |
319 service->DismissAppList(); | 323 service->DismissAppList(); |
320 } | 324 } |
321 | 325 |
322 } // namespace | 326 } // namespace |
OLD | NEW |