| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/translate/translate_bubble_view.h" | 5 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 TEST_F(TranslateBubbleViewTest, CloseButtonIn2016Q2UI) { | 208 TEST_F(TranslateBubbleViewTest, CloseButtonIn2016Q2UI) { |
| 209 TurnOnTranslate2016Q2UIFlag(); | 209 TurnOnTranslate2016Q2UIFlag(); |
| 210 CreateAndShowBubble(); | 210 CreateAndShowBubble(); |
| 211 EXPECT_FALSE(mock_model_->translate_called_); | 211 EXPECT_FALSE(mock_model_->translate_called_); |
| 212 EXPECT_FALSE(mock_model_->translation_declined_); | 212 EXPECT_FALSE(mock_model_->translation_declined_); |
| 213 EXPECT_FALSE(bubble_->GetWidget()->IsClosed()); | 213 EXPECT_FALSE(bubble_->GetWidget()->IsClosed()); |
| 214 | 214 |
| 215 // Press the "Close" button. | 215 // Press the "Close" button. |
| 216 bubble_->GetBubbleFrameView()->ButtonPressed( | 216 bubble_->GetBubbleFrameView()->ButtonPressed( |
| 217 bubble_->GetBubbleFrameView()->GetCloseButtonForTest(), | 217 bubble_->GetBubbleFrameView()->GetCloseButtonForTest(), |
| 218 ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), | 218 ui::MouseEvent( |
| 219 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE)); | 219 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), |
| 220 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE, |
| 221 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE))); |
| 220 | 222 |
| 221 EXPECT_FALSE(mock_model_->translate_called_); | 223 EXPECT_FALSE(mock_model_->translate_called_); |
| 222 EXPECT_TRUE(mock_model_->translation_declined_); | 224 EXPECT_TRUE(mock_model_->translation_declined_); |
| 223 } | 225 } |
| 224 | 226 |
| 225 TEST_F(TranslateBubbleViewTest, ComboboxNope) { | 227 TEST_F(TranslateBubbleViewTest, ComboboxNope) { |
| 226 CreateAndShowBubble(); | 228 CreateAndShowBubble(); |
| 227 views::test::ComboboxTestApi test_api(denial_combobox()); | 229 views::test::ComboboxTestApi test_api(denial_combobox()); |
| 228 EXPECT_FALSE(denial_button_clicked()); | 230 EXPECT_FALSE(denial_button_clicked()); |
| 229 EXPECT_FALSE(bubble_->GetWidget()->IsClosed()); | 231 EXPECT_FALSE(bubble_->GetWidget()->IsClosed()); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 TEST_F(TranslateBubbleViewTest, CancelButtonReturningError) { | 460 TEST_F(TranslateBubbleViewTest, CancelButtonReturningError) { |
| 459 CreateAndShowBubble(); | 461 CreateAndShowBubble(); |
| 460 bubble_->SwitchView(TranslateBubbleModel::VIEW_STATE_ERROR); | 462 bubble_->SwitchView(TranslateBubbleModel::VIEW_STATE_ERROR); |
| 461 bubble_->SwitchView(TranslateBubbleModel::VIEW_STATE_ADVANCED); | 463 bubble_->SwitchView(TranslateBubbleModel::VIEW_STATE_ADVANCED); |
| 462 | 464 |
| 463 // Click the "Cancel" button to go back. | 465 // Click the "Cancel" button to go back. |
| 464 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_ADVANCED, bubble_->GetViewState()); | 466 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_ADVANCED, bubble_->GetViewState()); |
| 465 bubble_->HandleButtonPressed(TranslateBubbleView::BUTTON_ID_CANCEL); | 467 bubble_->HandleButtonPressed(TranslateBubbleView::BUTTON_ID_CANCEL); |
| 466 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_ERROR, bubble_->GetViewState()); | 468 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_ERROR, bubble_->GetViewState()); |
| 467 } | 469 } |
| OLD | NEW |