| 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 "chrome/browser/ui/views/intent_picker_bubble_view.h" | 5 #include "chrome/browser/ui/views/intent_picker_bubble_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 for (size_t i = 0; i < size; ++i) { | 111 for (size_t i = 0; i < size; ++i) { |
| 112 EXPECT_EQ(bubble_->GetInkDropStateForTesting(i), | 112 EXPECT_EQ(bubble_->GetInkDropStateForTesting(i), |
| 113 views::InkDropState::HIDDEN); | 113 views::InkDropState::HIDDEN); |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 // Press each button at a time and make sure it goes to ACTIVATED state, | 117 // Press each button at a time and make sure it goes to ACTIVATED state, |
| 118 // followed by HIDDEN state after selecting other button. | 118 // followed by HIDDEN state after selecting other button. |
| 119 TEST_F(IntentPickerBubbleViewTest, InkDropStateTransition) { | 119 TEST_F(IntentPickerBubbleViewTest, InkDropStateTransition) { |
| 120 CreateBubbleView(true); | 120 CreateBubbleView(true); |
| 121 const ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), | 121 const ui::MouseEvent event( |
| 122 ui::EventTimeForNow(), 0, 0); | 122 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 123 0, 0, ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 123 size_t size = bubble_->app_info_.size(); | 124 size_t size = bubble_->app_info_.size(); |
| 124 for (size_t i = 0; i < size; ++i) { | 125 for (size_t i = 0; i < size; ++i) { |
| 125 bubble_->PressButtonForTesting((i + 1) % size, event); | 126 bubble_->PressButtonForTesting((i + 1) % size, event); |
| 126 EXPECT_EQ(bubble_->GetInkDropStateForTesting(i), | 127 EXPECT_EQ(bubble_->GetInkDropStateForTesting(i), |
| 127 views::InkDropState::HIDDEN); | 128 views::InkDropState::HIDDEN); |
| 128 EXPECT_EQ(bubble_->GetInkDropStateForTesting((i + 1) % size), | 129 EXPECT_EQ(bubble_->GetInkDropStateForTesting((i + 1) % size), |
| 129 views::InkDropState::ACTIVATED); | 130 views::InkDropState::ACTIVATED); |
| 130 } | 131 } |
| 131 } | 132 } |
| 132 | 133 |
| 133 // Arbitrary press the first button twice, check that the InkDropState remains | 134 // Arbitrary press the first button twice, check that the InkDropState remains |
| 134 // the same. | 135 // the same. |
| 135 TEST_F(IntentPickerBubbleViewTest, PressButtonTwice) { | 136 TEST_F(IntentPickerBubbleViewTest, PressButtonTwice) { |
| 136 CreateBubbleView(true); | 137 CreateBubbleView(true); |
| 137 const ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), | 138 const ui::MouseEvent event( |
| 138 ui::EventTimeForNow(), 0, 0); | 139 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 140 0, 0, ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 139 EXPECT_EQ(bubble_->GetInkDropStateForTesting(0), views::InkDropState::HIDDEN); | 141 EXPECT_EQ(bubble_->GetInkDropStateForTesting(0), views::InkDropState::HIDDEN); |
| 140 bubble_->PressButtonForTesting(0, event); | 142 bubble_->PressButtonForTesting(0, event); |
| 141 EXPECT_EQ(bubble_->GetInkDropStateForTesting(0), | 143 EXPECT_EQ(bubble_->GetInkDropStateForTesting(0), |
| 142 views::InkDropState::ACTIVATED); | 144 views::InkDropState::ACTIVATED); |
| 143 bubble_->PressButtonForTesting(0, event); | 145 bubble_->PressButtonForTesting(0, event); |
| 144 EXPECT_EQ(bubble_->GetInkDropStateForTesting(0), | 146 EXPECT_EQ(bubble_->GetInkDropStateForTesting(0), |
| 145 views::InkDropState::ACTIVATED); | 147 views::InkDropState::ACTIVATED); |
| 146 } | 148 } |
| OLD | NEW |