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

Unified Diff: chrome/browser/ui/test/test_app_window_icon_observer.h

Issue 2900783003: Handle app custom icon via aura::Window property. (Closed)
Patch Set: fix mac compile Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/test/test_app_window_icon_observer.h
diff --git a/chrome/browser/ui/test/test_app_window_icon_observer.h b/chrome/browser/ui/test/test_app_window_icon_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..c83d1e98452931be7ccdbb2897fa10be96856089
--- /dev/null
+++ b/chrome/browser/ui/test/test_app_window_icon_observer.h
@@ -0,0 +1,53 @@
+// 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_ICON_OBSERVER_H_
+#define CHROME_BROWSER_UI_TEST_TEST_APP_WINDOW_ICON_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;
+}
+
+// A test helper that waits for AppWindow icon property updates.
+class TestAppWindowIconObserver
+ : public extensions::AppWindowRegistry::Observer,
+ public aura::WindowObserver {
+ public:
+ explicit TestAppWindowIconObserver(content::BrowserContext* context);
+ ~TestAppWindowIconObserver() 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 expected_icon_updates_ = 0;
+ std::vector<aura::Window*> windows_;
+ base::OnceClosure icon_updated_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestAppWindowIconObserver);
+};
+
+#endif // CHROME_BROWSER_UI_TEST_TEST_APP_WINDOW_ICON_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698