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

Side by Side Diff: chrome/browser/ui/tab_modal_confirm_dialog_browsertest.cc

Issue 1160073004: chrome/browser/ui: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check for task runner instead of current message loop. Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/tab_modal_confirm_dialog_browsertest.h" 5 #include "chrome/browser/ui/tab_modal_confirm_dialog_browsertest.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
8 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/thread_task_runner_handle.h"
9 #include "chrome/browser/lifetime/application_lifetime.h" 12 #include "chrome/browser/lifetime/application_lifetime.h"
10 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_dialogs.h" 14 #include "chrome/browser/ui/browser_dialogs.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "content/public/browser/page_navigator.h" 16 #include "content/public/browser/page_navigator.h"
14 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
15 #include "content/public/test/test_utils.h" 18 #include "content/public/test/test_utils.h"
16 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/base/window_open_disposition.h" 20 #include "ui/base/window_open_disposition.h"
18 21
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ui::PAGE_TRANSITION_LINK, 126 ui::PAGE_TRANSITION_LINK,
124 false); 127 false);
125 browser()->tab_strip_model()->GetActiveWebContents()->OpenURL(params); 128 browser()->tab_strip_model()->GetActiveWebContents()->OpenURL(params);
126 129
127 EXPECT_EQ(0, accepted_count_); 130 EXPECT_EQ(0, accepted_count_);
128 EXPECT_EQ(0, canceled_count_); 131 EXPECT_EQ(0, canceled_count_);
129 EXPECT_EQ(1, closed_count_); 132 EXPECT_EQ(1, closed_count_);
130 } 133 }
131 134
132 IN_PROC_BROWSER_TEST_F(TabModalConfirmDialogTest, Quit) { 135 IN_PROC_BROWSER_TEST_F(TabModalConfirmDialogTest, Quit) {
133 base::MessageLoopForUI::current()->PostTask(FROM_HERE, 136 base::ThreadTaskRunnerHandle::Get()->PostTask(
134 base::Bind(&chrome::AttemptExit)); 137 FROM_HERE, base::Bind(&chrome::AttemptExit));
135 content::RunMessageLoop(); 138 content::RunMessageLoop();
msw 2015/06/10 00:12:57 Is this still correct?
Sami 2015/06/10 12:35:33 Yes, it is posting a task to the same message loop
msw 2015/06/10 19:34:00 If feels odd to post a task to base::ThreadTaskRun
136 EXPECT_EQ(0, accepted_count_); 139 EXPECT_EQ(0, accepted_count_);
137 EXPECT_EQ(0, canceled_count_); 140 EXPECT_EQ(0, canceled_count_);
138 EXPECT_EQ(1, closed_count_); 141 EXPECT_EQ(1, closed_count_);
139 } 142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698