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

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: 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 bc74dcceeab4b4c1d3e14ffc4084083db573c0db..940e53f56c72970301a9f78fb9c3b1e070747519 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:example_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();
}
@@ -431,7 +443,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());
@@ -445,10 +459,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