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

Unified Diff: mojo/services/public/cpp/view_manager/tests/view_manager_unittest.cc

Issue 658923003: Remove dependency on ui from view_manager. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebase Created 6 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 side-by-side diff with in-line comments
Download patch
Index: mojo/services/public/cpp/view_manager/tests/view_manager_unittest.cc
diff --git a/mojo/services/public/cpp/view_manager/tests/view_manager_unittest.cc b/mojo/services/public/cpp/view_manager/tests/view_manager_unittest.cc
index eafc3b9183e713e1b8f5995241c9b576c5d7b834..83a1ce0b096fc79b44a3c46274878e5bbb52861c 100644
--- a/mojo/services/public/cpp/view_manager/tests/view_manager_unittest.cc
+++ b/mojo/services/public/cpp/view_manager/tests/view_manager_unittest.cc
@@ -23,6 +23,18 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
+
+// TODO(jam): move these somewhere else so they can be shared?
+
+inline bool operator==(const Rect& lhs, const Rect& rhs) {
+ return lhs.x == rhs.x && lhs.y == rhs.y && lhs.width == rhs.width &&
+ lhs.height == lhs.height;
+}
+
+inline bool operator!=(const Rect& lhs, const Rect& rhs) {
+ return !(lhs == rhs);
+}
+
namespace {
const char kWindowManagerURL[] = "mojo:window_manager";
@@ -102,8 +114,8 @@ class BoundsChangeObserver : public ViewObserver {
private:
// Overridden from ViewObserver:
void OnViewBoundsChanged(View* view,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) override {
+ const Rect& old_bounds,
+ const Rect& new_bounds) override {
DCHECK_EQ(view, view_);
QuitRunLoop();
}
@@ -410,7 +422,9 @@ TEST_F(ViewManagerTest, DISABLED_SetBounds) {
View* view_in_embedded = embedded->GetViewById(view->id());
EXPECT_EQ(view->bounds(), view_in_embedded->bounds());
- view->SetBounds(gfx::Rect(100, 100));
+ Rect rect;
+ rect.width = rect.height = 100;
+ view->SetBounds(rect);
EXPECT_NE(view->bounds(), view_in_embedded->bounds());
WaitForBoundsToChange(view_in_embedded);
EXPECT_EQ(view->bounds(), view_in_embedded->bounds());
@@ -424,10 +438,15 @@ TEST_F(ViewManagerTest, DISABLED_SetBoundsSecurity) {
ViewManager* embedded = Embed(window_manager(), view);
View* view_in_embedded = embedded->GetViewById(view->id());
- view->SetBounds(gfx::Rect(800, 600));
+ Rect rect;
+ rect.width = 800;
+ rect.height = 600;
+ view->SetBounds(rect);
WaitForBoundsToChange(view_in_embedded);
- view_in_embedded->SetBounds(gfx::Rect(1024, 768));
+ rect.width = 1024;
+ rect.height = 768;
+ view_in_embedded->SetBounds(rect);
// Bounds change should have been rejected.
EXPECT_EQ(view->bounds(), view_in_embedded->bounds());
}

Powered by Google App Engine
This is Rietveld 408576698