Chromium Code Reviews| Index: chrome/browser/ui/test/test_app_window_observer.h |
| diff --git a/chrome/browser/ui/test/test_app_window_observer.h b/chrome/browser/ui/test/test_app_window_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9c4b774101009ec3c3d3883e40375997182ef968 |
| --- /dev/null |
| +++ b/chrome/browser/ui/test/test_app_window_observer.h |
| @@ -0,0 +1,50 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_TEST_TEST_APP_WINDOW_OBSERVER_H_ |
| +#define CHROME_BROWSER_UI_TEST_TEST_APP_WINDOW_OBSERVER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/callback.h" |
| +#include "base/macros.h" |
| +#include "extensions/browser/app_window/app_window_registry.h" |
| +#include "ui/aura/window_observer.h" |
| + |
| +namespace content { |
| +class BrowserContext; |
| +} |
| + |
| +class TestAppWindowObserver : public extensions::AppWindowRegistry::Observer, |
| + public aura::WindowObserver { |
| + public: |
| + explicit TestAppWindowObserver(content::BrowserContext* context); |
| + ~TestAppWindowObserver() override; |
| + |
| + // Waits for one icon update. |
| + void WaitForIconUpdate(); |
| + // Waits for |updates| number of icon updates. |
| + void WaitForIconUpdates(int updates); |
| + |
| + int icon_updates() const { return icon_updates_; } |
| + |
| + private: |
| + // AppWindowRegistry::Observer: |
| + void OnAppWindowAdded(extensions::AppWindow* app_window) override; |
| + void OnAppWindowRemoved(extensions::AppWindow* app_window) override; |
| + |
| + // aura::WindowObserver: |
| + void OnWindowPropertyChanged(aura::Window* window, |
| + const void* key, |
| + intptr_t old) override; |
| + content::BrowserContext* const context_; |
| + int icon_updates_ = 0; |
| + int expeced_icon_updates_ = 0; |
|
Devlin
2017/05/31 22:00:01
typo: expected
khmel
2017/06/01 16:56:52
Done.
|
| + std::vector<aura::Window*> windows_; |
| + base::OnceClosure icon_updated_callback_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TestAppWindowObserver); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_TEST_TEST_APP_WINDOW_OBSERVER_H_ |