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

Unified Diff: chrome/browser/ui/ash/app_list/app_list_controller_ash_browsertest.cc

Issue 2487953003: Remove LauncherItemController::IsOpen, check ShelfItem::status. (Closed)
Patch Set: Cleanup. Created 4 years, 1 month 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
Index: chrome/browser/ui/ash/app_list/app_list_controller_ash_browsertest.cc
diff --git a/chrome/browser/ui/ash/app_list/app_list_controller_ash_browsertest.cc b/chrome/browser/ui/ash/app_list/app_list_controller_ash_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6f5b9e52177d423af19bd2374c9ab0eddac28dab
--- /dev/null
+++ b/chrome/browser/ui/ash/app_list/app_list_controller_ash_browsertest.cc
@@ -0,0 +1,56 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/apps/app_browsertest_util.h"
+#include "chrome/browser/extensions/extension_browsertest.h"
+#include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h"
+#include "chrome/browser/ui/extensions/app_launch_params.h"
+#include "chrome/browser/ui/extensions/application_launch.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_types.h"
+#include "content/public/test/test_utils.h"
+
+using AppListControllerDelegateAshTest = extensions::PlatformAppBrowserTest;
+
+// Test AppListControllerDelegateAsh::IsAppOpen for extension apps.
+IN_PROC_BROWSER_TEST_F(AppListControllerDelegateAshTest, IsExtensionAppOpen) {
+ AppListControllerDelegateAsh delegate_ash(nullptr);
+ AppListControllerDelegate* delegate = &delegate_ash;
James Cook 2016/11/10 01:39:53 optional nit: This is a little odd. I see you are
msw 2016/11/10 02:39:09 Done (made functions public).
+
+ EXPECT_FALSE(delegate->IsAppOpen("fake_extension_app_id"));
+
+ base::FilePath extension_path = test_data_dir_.AppendASCII("app");
+ const extensions::Extension* extension_app = LoadExtension(extension_path);
+ ASSERT_NE(nullptr, extension_app);
+ EXPECT_FALSE(delegate->IsAppOpen(extension_app->id()));
+ {
+ content::WindowedNotificationObserver app_loaded_observer(
+ content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
+ content::NotificationService::AllSources());
+ OpenApplication(AppLaunchParams(
+ profile(), extension_app, extensions::LAUNCH_CONTAINER_WINDOW,
+ WindowOpenDisposition::NEW_WINDOW, extensions::SOURCE_TEST));
+ app_loaded_observer.Wait();
+ }
+ EXPECT_TRUE(delegate->IsAppOpen(extension_app->id()));
+}
+
+// Test AppListControllerDelegateAsh::IsAppOpen for platform apps.
+IN_PROC_BROWSER_TEST_F(AppListControllerDelegateAshTest, IsPlatformAppOpen) {
+ AppListControllerDelegateAsh delegate_ash(nullptr);
+ AppListControllerDelegate* delegate = &delegate_ash;
+
+ EXPECT_FALSE(delegate->IsAppOpen("fake_platform_app_id"));
+
+ const extensions::Extension* app = InstallPlatformApp("minimal");
+ EXPECT_FALSE(delegate->IsAppOpen(app->id()));
+ {
+ content::WindowedNotificationObserver app_loaded_observer(
+ content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
+ content::NotificationService::AllSources());
+ LaunchPlatformApp(app);
+ app_loaded_observer.Wait();
+ }
+ EXPECT_TRUE(delegate->IsAppOpen(app->id()));
+}

Powered by Google App Engine
This is Rietveld 408576698