| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/display/display_manager.h" | 5 #include "ash/display/display_manager.h" |
| 6 #include "ash/screen_util.h" | 6 #include "ash/screen_util.h" |
| 7 #include "ash/shelf/shelf.h" | 7 #include "ash/shelf/shelf.h" |
| 8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/system/toast/toast_manager.h" | 10 #include "ash/system/toast/toast_manager.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 return overlay ? overlay->text_ : std::string(); | 58 return overlay ? overlay->text_ : std::string(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void ClickDismissButton() { | 61 void ClickDismissButton() { |
| 62 ToastOverlay* overlay = GetCurrentOverlay(); | 62 ToastOverlay* overlay = GetCurrentOverlay(); |
| 63 if (overlay) | 63 if (overlay) |
| 64 overlay->ClickDismissButtonForTesting(DummyEvent()); | 64 overlay->ClickDismissButtonForTesting(DummyEvent()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void SetShelfAlignment(wm::ShelfAlignment alignment) { | 67 void SetShelfAlignment(wm::ShelfAlignment alignment) { |
| 68 Shelf::ForPrimaryDisplay()->shelf_layout_manager()->SetAlignment(alignment); | 68 Shelf::ForPrimaryDisplay()->SetAlignment(alignment); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void SetShelfState(ShelfVisibilityState state) { | 71 void SetShelfState(ShelfVisibilityState state) { |
| 72 Shelf::ForPrimaryDisplay()->shelf_layout_manager()->SetState(state); | 72 Shelf::ForPrimaryDisplay()->shelf_layout_manager()->SetState(state); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior) { | 75 void SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior) { |
| 76 Shelf::ForPrimaryDisplay()->shelf_layout_manager()->SetAutoHideBehavior( | 76 Shelf::ForPrimaryDisplay()->SetAutoHideBehavior(behavior); |
| 77 behavior); | |
| 78 } | 77 } |
| 79 | 78 |
| 80 std::string ShowToast(const std::string& text, uint64_t duration) { | 79 std::string ShowToast(const std::string& text, uint64_t duration) { |
| 81 std::string id = "TOAST_ID_" + base::UintToString(serial_++); | 80 std::string id = "TOAST_ID_" + base::UintToString(serial_++); |
| 82 manager()->Show(ToastData(id, text, duration)); | 81 manager()->Show(ToastData(id, text, duration)); |
| 83 return id; | 82 return id; |
| 84 } | 83 } |
| 85 | 84 |
| 86 void CancelToast(const std::string& id) { manager()->Cancel(id); } | 85 void CancelToast(const std::string& id) { manager()->Cancel(id); } |
| 87 | 86 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 EXPECT_EQ("TEXT3", GetCurrentText()); | 298 EXPECT_EQ("TEXT3", GetCurrentText()); |
| 300 // Cancel the shown toast. | 299 // Cancel the shown toast. |
| 301 CancelToast(id3); | 300 CancelToast(id3); |
| 302 // Confirm that the shown toast disappears. | 301 // Confirm that the shown toast disappears. |
| 303 EXPECT_FALSE(GetCurrentOverlay()); | 302 EXPECT_FALSE(GetCurrentOverlay()); |
| 304 // Confirm that only 1 toast is shown. | 303 // Confirm that only 1 toast is shown. |
| 305 EXPECT_EQ(2, GetToastSerial()); | 304 EXPECT_EQ(2, GetToastSerial()); |
| 306 } | 305 } |
| 307 | 306 |
| 308 } // namespace ash | 307 } // namespace ash |
| OLD | NEW |