| 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_ICON_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_UI_TEST_TEST_APP_WINDOW_ICON_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 // A test helper that waits for AppWindow icon property updates. |
| 20 class TestAppWindowIconObserver |
| 21 : public extensions::AppWindowRegistry::Observer, |
| 22 public aura::WindowObserver { |
| 23 public: |
| 24 explicit TestAppWindowIconObserver(content::BrowserContext* context); |
| 25 ~TestAppWindowIconObserver() override; |
| 26 |
| 27 // Waits for one icon update. |
| 28 void WaitForIconUpdate(); |
| 29 // Waits for |updates| number of icon updates. |
| 30 void WaitForIconUpdates(int updates); |
| 31 |
| 32 int icon_updates() const { return icon_updates_; } |
| 33 |
| 34 private: |
| 35 // AppWindowRegistry::Observer: |
| 36 void OnAppWindowAdded(extensions::AppWindow* app_window) override; |
| 37 void OnAppWindowRemoved(extensions::AppWindow* app_window) override; |
| 38 |
| 39 // aura::WindowObserver: |
| 40 void OnWindowPropertyChanged(aura::Window* window, |
| 41 const void* key, |
| 42 intptr_t old) override; |
| 43 |
| 44 content::BrowserContext* const context_; |
| 45 int icon_updates_ = 0; |
| 46 int expected_icon_updates_ = 0; |
| 47 std::vector<aura::Window*> windows_; |
| 48 base::OnceClosure icon_updated_callback_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(TestAppWindowIconObserver); |
| 51 }; |
| 52 |
| 53 #endif // CHROME_BROWSER_UI_TEST_TEST_APP_WINDOW_ICON_OBSERVER_H_ |
| OLD | NEW |