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

Side by Side Diff: chrome/test/base/ui_test_utils.h

Issue 2441543004: Refactor BrowserActivationWaiter as test support and move PopupBlockerBrowserTest to interactive_ui… (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « chrome/test/BUILD.gn ('k') | chrome/test/base/ui_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_TEST_BASE_UI_TEST_UTILS_H_ 5 #ifndef CHROME_TEST_BASE_UI_TEST_UTILS_H_
6 #define CHROME_TEST_BASE_UI_TEST_UTILS_H_ 6 #define CHROME_TEST_BASE_UI_TEST_UTILS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/browser/ui/browser_list_observer.h"
17 #include "components/history/core/browser/history_service.h" 19 #include "components/history/core/browser/history_service.h"
18 #include "content/public/browser/notification_details.h" 20 #include "content/public/browser/notification_details.h"
19 #include "content/public/browser/notification_observer.h" 21 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
21 #include "content/public/browser/notification_source.h" 23 #include "content/public/browser/notification_source.h"
22 #include "content/public/test/test_utils.h" 24 #include "content/public/test/test_utils.h"
23 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
24 #include "ui/base/window_open_disposition.h" 26 #include "ui/base/window_open_disposition.h"
25 #include "ui/events/keycodes/keyboard_codes.h" 27 #include "ui/events/keycodes/keyboard_codes.h"
26 #include "ui/gfx/native_widget_types.h" 28 #include "ui/gfx/native_widget_types.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 const base::Closure& quit_task, 282 const base::Closure& quit_task,
281 history::QueryResults* results); 283 history::QueryResults* results);
282 284
283 std::vector<GURL> urls_; 285 std::vector<GURL> urls_;
284 286
285 base::CancelableTaskTracker tracker_; 287 base::CancelableTaskTracker tracker_;
286 288
287 DISALLOW_COPY_AND_ASSIGN(HistoryEnumerator); 289 DISALLOW_COPY_AND_ASSIGN(HistoryEnumerator);
288 }; 290 };
289 291
292 // Use in browser interactive uitests to wait until a browser is set to active.
293 // To use create and call WaitForActivation().
294 // TODO(warx): check if code base exists the requirement for deactivation sync,
295 // this class can be modified to support that.
296 class BrowserActivationWaiter : public chrome::BrowserListObserver {
297 public:
298 explicit BrowserActivationWaiter(Browser* browser);
299 ~BrowserActivationWaiter() override;
300
301 // Returns when the |browser_| which is supplied by the constructor becomes
302 // activated. If it is not activated, a message loop is used until the
303 // |browser_| is activated, otherwise this returns immediately.
304 void WaitForActivation();
305
306 private:
307 // chrome::BrowserListObserver override:
308 void OnBrowserSetLastActive(Browser* browser) override;
309
310 Browser* browser_;
311 bool observed_;
312 scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
313
314 DISALLOW_COPY_AND_ASSIGN(BrowserActivationWaiter);
315 };
316
290 } // namespace ui_test_utils 317 } // namespace ui_test_utils
291 318
292 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ 319 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « chrome/test/BUILD.gn ('k') | chrome/test/base/ui_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698