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

Unified Diff: ash/wm_window_user_data_unittest.cc

Issue 2734733002: Revert "chromeos: Move files in //ash/common to //ash, part 3" (Closed)
Patch Set: Created 3 years, 9 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 | « ash/wm_window_user_data.h ('k') | chrome/browser/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm_window_user_data_unittest.cc
diff --git a/ash/wm_window_user_data_unittest.cc b/ash/wm_window_user_data_unittest.cc
deleted file mode 100644
index 7db7620af58bcbc87ce8c623f31901eb92913d9a..0000000000000000000000000000000000000000
--- a/ash/wm_window_user_data_unittest.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2016 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.
-
-#include "ash/wm_window_user_data.h"
-
-#include <memory>
-
-#include "ash/test/ash_test.h"
-#include "ash/wm_shell.h"
-#include "ash/wm_window.h"
-#include "ash/wm_window_user_data.h"
-#include "base/memory/ptr_util.h"
-
-namespace ash {
-namespace {
-
-// Class that sets a bool* to true from the destructor. Used to track
-// destruction.
-class Data {
- public:
- explicit Data(bool* delete_setter) : delete_setter_(delete_setter) {}
- ~Data() { *delete_setter_ = true; }
-
- private:
- bool* delete_setter_;
-
- DISALLOW_COPY_AND_ASSIGN(Data);
-};
-
-} // namespace
-
-using WmWindowUserDataTest = AshTest;
-
-// Verifies clear() deletes the data associated with a window.
-TEST_F(WmWindowUserDataTest, ClearDestroys) {
- WmWindowUserData<Data> user_data;
- WmWindow* window = WmShell::Get()->NewWindow(ui::wm::WINDOW_TYPE_UNKNOWN,
- ui::LAYER_NOT_DRAWN);
- bool data_deleted = false;
- user_data.Set(window, base::MakeUnique<Data>(&data_deleted));
- EXPECT_FALSE(data_deleted);
- user_data.clear();
- EXPECT_TRUE(data_deleted);
- window->Destroy();
-}
-
-// Verifies Set() called with an existing window replaces the existing data.
-TEST_F(WmWindowUserDataTest, ReplaceDestroys) {
- WmWindowUserData<Data> user_data;
- WmWindow* window = WmShell::Get()->NewWindow(ui::wm::WINDOW_TYPE_UNKNOWN,
- ui::LAYER_NOT_DRAWN);
- bool data1_deleted = false;
- user_data.Set(window, base::MakeUnique<Data>(&data1_deleted));
- EXPECT_FALSE(data1_deleted);
- bool data2_deleted = false;
- user_data.Set(window, base::MakeUnique<Data>(&data2_deleted));
- EXPECT_TRUE(data1_deleted);
- EXPECT_FALSE(data2_deleted);
- ASSERT_EQ(1u, user_data.GetWindows().size());
- EXPECT_EQ(window, *user_data.GetWindows().begin());
- window->Destroy();
- EXPECT_TRUE(data2_deleted);
- EXPECT_TRUE(user_data.GetWindows().empty());
-}
-
-// Verifies Set() with null deletes existing data.
-TEST_F(WmWindowUserDataTest, NullClears) {
- WmWindowUserData<Data> user_data;
- WmWindow* window = WmShell::Get()->NewWindow(ui::wm::WINDOW_TYPE_UNKNOWN,
- ui::LAYER_NOT_DRAWN);
- bool data1_deleted = false;
- user_data.Set(window, base::MakeUnique<Data>(&data1_deleted));
- EXPECT_FALSE(data1_deleted);
- user_data.Set(window, nullptr);
- EXPECT_TRUE(data1_deleted);
- EXPECT_TRUE(user_data.GetWindows().empty());
- window->Destroy();
-}
-
-} // namespace ash
« no previous file with comments | « ash/wm_window_user_data.h ('k') | chrome/browser/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698