Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_TEST_TEST_APP_WINDOW_OBSERVER_H_ | |
| 6 #define CHROME_BROWSER_UI_TEST_TEST_APP_WINDOW_OBSERVER_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "extensions/browser/app_window/app_window_registry.h" | |
| 13 #include "ui/aura/window_observer.h" | |
| 14 | |
| 15 namespace content { | |
| 16 class BrowserContext; | |
| 17 } | |
| 18 | |
| 19 class TestAppWindowObserver : public extensions::AppWindowRegistry::Observer, | |
|
msw
2017/06/01 19:47:28
nit: comment "A test helper that waits for AppWind
khmel
2017/06/01 21:55:46
Done.
| |
| 20 public aura::WindowObserver { | |
| 21 public: | |
| 22 explicit TestAppWindowObserver(content::BrowserContext* context); | |
| 23 ~TestAppWindowObserver() override; | |
| 24 | |
| 25 // Waits for one icon update. | |
| 26 void WaitForIconUpdate(); | |
| 27 // Waits for |updates| number of icon updates. | |
| 28 void WaitForIconUpdates(int updates); | |
| 29 | |
| 30 int icon_updates() const { return icon_updates_; } | |
| 31 | |
| 32 private: | |
| 33 // AppWindowRegistry::Observer: | |
| 34 void OnAppWindowAdded(extensions::AppWindow* app_window) override; | |
| 35 void OnAppWindowRemoved(extensions::AppWindow* app_window) override; | |
| 36 | |
| 37 // aura::WindowObserver: | |
| 38 void OnWindowPropertyChanged(aura::Window* window, | |
| 39 const void* key, | |
| 40 intptr_t old) override; | |
| 41 content::BrowserContext* const context_; | |
|
msw
2017/06/01 19:47:28
nit: add a blank line above
khmel
2017/06/01 21:55:46
Done.
| |
| 42 int icon_updates_ = 0; | |
| 43 int expected_icon_updates_ = 0; | |
| 44 std::vector<aura::Window*> windows_; | |
| 45 base::OnceClosure icon_updated_callback_; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(TestAppWindowObserver); | |
| 48 }; | |
| 49 | |
| 50 #endif // CHROME_BROWSER_UI_TEST_TEST_APP_WINDOW_OBSERVER_H_ | |
| OLD | NEW |