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

Unified Diff: chrome/browser/ui/ash/multi_user/user_switch_util_unittest.cc

Issue 2468873005: Reland of Use a standard message box for DesktopCastingWarningView. (Closed)
Patch Set: 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/multi_user/user_switch_util_unittest.cc
diff --git a/chrome/browser/ui/ash/multi_user/user_switch_util_unittest.cc b/chrome/browser/ui/ash/multi_user/user_switch_util_unittest.cc
index 623e65db3f6829f58f91af99b1b6265b814794d4..0c5acab85a2711c57aa8a808e18dff043d6f643e 100644
--- a/chrome/browser/ui/ash/multi_user/user_switch_util_unittest.cc
+++ b/chrome/browser/ui/ash/multi_user/user_switch_util_unittest.cc
@@ -7,7 +7,10 @@
#include "ash/common/wm/overview/window_selector_controller.h"
#include "ash/common/wm_shell.h"
#include "ash/test/ash_test_base.h"
+#include "base/run_loop.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/ui/ash/multi_user/user_switch_util.h"
+#include "chrome/browser/ui/simple_message_box.h"
#include "ui/aura/window.h"
namespace ash {
@@ -68,19 +71,11 @@
// The passed |action| type parameter defines the outcome (which will be
// checked) and the action the user will choose.
void SwitchUser(ActionType action) {
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&CloseMessageBox, action));
TrySwitchingActiveUser(base::Bind(&TrySwitchingUserTest::SwitchCallback,
base::Unretained(this)));
- switch (action) {
- case NO_DIALOG:
- EXPECT_TRUE(!TestAndTerminateDesktopCastingWarningForTest(true));
- return;
- case ACCEPT_DIALOG:
- EXPECT_TRUE(TestAndTerminateDesktopCastingWarningForTest(true));
- return;
- case DECLINE_DIALOG:
- EXPECT_TRUE(TestAndTerminateDesktopCastingWarningForTest(false));
- return;
- }
+ base::RunLoop().RunUntilIdle();
}
// Called when the user will get actually switched.
@@ -110,6 +105,20 @@
int switch_callback_hit_count() const { return switch_callback_hit_count_; }
private:
+ static void CloseMessageBox(ActionType action) {
+ switch (action) {
+ case NO_DIALOG:
+ EXPECT_FALSE(chrome::CloseMessageBoxForTest(true));
+ return;
+ case ACCEPT_DIALOG:
+ EXPECT_TRUE(chrome::CloseMessageBoxForTest(true));
+ return;
+ case DECLINE_DIALOG:
+ EXPECT_TRUE(chrome::CloseMessageBoxForTest(false));
+ return;
+ }
+ }
+
// The two items from the SystemTray for the screen capture / share
// functionality.
ScreenTrayItem* capture_item_;
« no previous file with comments | « chrome/browser/ui/ash/multi_user/user_switch_util.cc ('k') | chrome/browser/ui/cocoa/simple_message_box_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698