| 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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "chrome/browser/ui/translate/translate_bubble_model.h" | 8 #include "chrome/browser/ui/translate/translate_bubble_model.h" |
| 9 #include "chrome/browser/ui/translate/translate_bubble_view_state_transition.h" | 9 #include "chrome/browser/ui/translate/translate_bubble_view_state_transition.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 anchor_widget_.reset(new views::Widget()); | 145 anchor_widget_.reset(new views::Widget()); |
| 146 anchor_widget_->Init(params); | 146 anchor_widget_->Init(params); |
| 147 anchor_widget_->Show(); | 147 anchor_widget_->Show(); |
| 148 | 148 |
| 149 mock_model_ = new MockTranslateBubbleModel( | 149 mock_model_ = new MockTranslateBubbleModel( |
| 150 TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE); | 150 TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE); |
| 151 scoped_ptr<TranslateBubbleModel> model(mock_model_); | 151 scoped_ptr<TranslateBubbleModel> model(mock_model_); |
| 152 bubble_ = new TranslateBubbleView(anchor_widget_->GetContentsView(), | 152 bubble_ = new TranslateBubbleView(anchor_widget_->GetContentsView(), |
| 153 model.Pass(), | 153 model.Pass(), |
| 154 TranslateErrors::NONE, | 154 TranslateErrors::NONE, |
| 155 NULL, | |
| 156 NULL); | 155 NULL); |
| 157 views::BubbleDelegateView::CreateBubble(bubble_)->Show(); | 156 views::BubbleDelegateView::CreateBubble(bubble_)->Show(); |
| 158 } | 157 } |
| 159 | 158 |
| 160 virtual void TearDown() OVERRIDE { | 159 virtual void TearDown() OVERRIDE { |
| 161 bubble_->GetWidget()->CloseNow(); | 160 bubble_->GetWidget()->CloseNow(); |
| 162 anchor_widget_.reset(); | 161 anchor_widget_.reset(); |
| 163 | 162 |
| 164 views::ViewsTestBase::TearDown(); | 163 views::ViewsTestBase::TearDown(); |
| 165 } | 164 } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 320 |
| 322 TEST_F(TranslateBubbleViewTest, CancelButtonReturningError) { | 321 TEST_F(TranslateBubbleViewTest, CancelButtonReturningError) { |
| 323 bubble_->SwitchView(TranslateBubbleModel::VIEW_STATE_ERROR); | 322 bubble_->SwitchView(TranslateBubbleModel::VIEW_STATE_ERROR); |
| 324 bubble_->SwitchView(TranslateBubbleModel::VIEW_STATE_ADVANCED); | 323 bubble_->SwitchView(TranslateBubbleModel::VIEW_STATE_ADVANCED); |
| 325 | 324 |
| 326 // Click the "Cancel" button to go back. | 325 // Click the "Cancel" button to go back. |
| 327 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_ADVANCED, bubble_->GetViewState()); | 326 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_ADVANCED, bubble_->GetViewState()); |
| 328 bubble_->HandleButtonPressed(TranslateBubbleView::BUTTON_ID_CANCEL); | 327 bubble_->HandleButtonPressed(TranslateBubbleView::BUTTON_ID_CANCEL); |
| 329 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_ERROR, bubble_->GetViewState()); | 328 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_ERROR, bubble_->GetViewState()); |
| 330 } | 329 } |
| OLD | NEW |