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

Unified Diff: ash/shelf/shelf_view_unittest.cc

Issue 2688353005: Fix shelf alignment and auto-hide initialization. (Closed)
Patch Set: Cleanup Created 3 years, 10 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: ash/shelf/shelf_view_unittest.cc
diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc
index 62f000f867213554ab25b48743d329abb39a43ce..e3f649091d3fbc1687e5226119c750c70d0d6456 100644
--- a/ash/shelf/shelf_view_unittest.cc
+++ b/ash/shelf/shelf_view_unittest.cc
@@ -244,9 +244,10 @@ TEST_F(WmShelfObserverIconTest, BoundsChanged) {
// A ShelfDelegate test double that will always convert between ShelfIDs and app
// ids. This does not support pinning and unpinning operations and the return
// value of IsAppPinned(...) is configurable.
-class TestShelfDelegateForShelfView : public ShelfDelegate {
+class TestShelfDelegateForShelfView : public TestShelfDelegate {
public:
- TestShelfDelegateForShelfView() {}
+ explicit TestShelfDelegateForShelfView(ShelfModel* model)
+ : TestShelfDelegate(model) {}
~TestShelfDelegateForShelfView() override {}
void set_is_app_pinned(bool is_pinned) { is_app_pinned_ = is_pinned; }
@@ -258,11 +259,6 @@ class TestShelfDelegateForShelfView : public ShelfDelegate {
return id;
}
- ShelfID GetShelfIDForAppIDAndLaunchID(const std::string& app_id,
- const std::string& launch_id) override {
- return GetShelfIDForAppID(app_id);
- }
-
bool HasShelfIDToAppIDMapping(ShelfID id) const override { return true; }
const std::string& GetAppIDForShelfID(ShelfID id) override {
@@ -685,7 +681,9 @@ class ShelfViewTest : public AshTestBase {
}
void ReplaceShelfDelegate() {
- shelf_delegate_ = new TestShelfDelegateForShelfView();
+ // Clear the value first to avoid TestShelfDelegate's singleton check.
+ WmShell::Get()->SetShelfDelegateForTesting(nullptr);
+ shelf_delegate_ = new TestShelfDelegateForShelfView(model_);
test_api_->SetShelfDelegate(shelf_delegate_);
WmShell::Get()->SetShelfDelegateForTesting(
base::WrapUnique(shelf_delegate_));
@@ -738,10 +736,6 @@ class ShelfViewTextDirectionTest : public ShelfViewTest,
ShelfViewTextDirectionTest() : text_direction_change_(GetParam()) {}
virtual ~ShelfViewTextDirectionTest() {}
- void SetUp() override { ShelfViewTest::SetUp(); }
-
- void TearDown() override { ShelfViewTest::TearDown(); }
-
private:
ScopedTextDirectionChange text_direction_change_;

Powered by Google App Engine
This is Rietveld 408576698