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

Unified Diff: ui/aura/window_unittest.cc

Issue 10854124: Revert 151293 - Makes Window not change focus and send out notifications when moving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « ui/aura/window.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window_unittest.cc
===================================================================
--- ui/aura/window_unittest.cc (revision 151297)
+++ ui/aura/window_unittest.cc (working copy)
@@ -8,7 +8,6 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "base/string_number_conversions.h"
#include "base/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/capture_client.h"
@@ -2462,53 +2461,5 @@
EXPECT_NE("0,0 100x100", window->bounds().ToString());
}
-namespace {
-
-// Used by AddChildNotifications to track notification counts.
-class AddChildNotificationsObserver : public WindowObserver {
- public:
- AddChildNotificationsObserver() : added_count_(0), removed_count_(0) {}
-
- std::string CountStringAndReset() {
- std::string result = base::IntToString(added_count_) + " " +
- base::IntToString(removed_count_);
- added_count_ = removed_count_ = 0;
- return result;
- }
-
- // WindowObserver overrides:
- virtual void OnWindowAddedToRootWindow(Window* window) OVERRIDE {
- added_count_++;
- }
- virtual void OnWindowRemovingFromRootWindow(Window* window) OVERRIDE {
- removed_count_++;
- }
-
- private:
- int added_count_;
- int removed_count_;
-
- DISALLOW_COPY_AND_ASSIGN(AddChildNotificationsObserver);
-};
-
-} // namespace
-
-// Assertions around when root window notifications are sent.
-TEST_F(WindowTest, AddChildNotifications) {
- AddChildNotificationsObserver observer;
- scoped_ptr<Window> w1(CreateTestWindowWithId(1, NULL));
- scoped_ptr<Window> w2(CreateTestWindowWithId(1, NULL));
- w2->AddObserver(&observer);
- w2->Focus();
- EXPECT_TRUE(w2->HasFocus());
-
- // Move |w2| to be a child of |w1|.
- w1->AddChild(w2.get());
- // Sine we moved in the same root, observer shouldn't be notified.
- EXPECT_EQ("0 0", observer.CountStringAndReset());
- // |w2| should still have focus after moving.
- EXPECT_TRUE(w2->HasFocus());
-}
-
} // namespace test
} // namespace aura
« no previous file with comments | « ui/aura/window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698