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

Unified Diff: chrome/browser/ui/views/translate/translate_bubble_view_unittest.cc

Issue 87503004: Pass the Translate error type to the bubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (rebasing) Created 7 years 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
« no previous file with comments | « chrome/browser/ui/views/translate/translate_bubble_view.cc ('k') | chrome/test/base/test_browser_window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/translate/translate_bubble_view_unittest.cc
diff --git a/chrome/browser/ui/views/translate/translate_bubble_view_unittest.cc b/chrome/browser/ui/views/translate/translate_bubble_view_unittest.cc
index 0b84c1bc4c10d5ab10ea88d7ace74fa5ba0d66a8..814ead2c44749ef34f98b88b63bd3812e579d756 100644
--- a/chrome/browser/ui/views/translate/translate_bubble_view_unittest.cc
+++ b/chrome/browser/ui/views/translate/translate_bubble_view_unittest.cc
@@ -19,6 +19,7 @@ class MockTranslateBubbleModel : public TranslateBubbleModel {
public:
explicit MockTranslateBubbleModel(TranslateBubbleModel::ViewState view_state)
: view_state_transition_(view_state),
+ error_type_(TranslateErrors::NONE),
original_language_index_(0),
target_language_index_(1),
never_translate_language_(false),
@@ -39,6 +40,14 @@ class MockTranslateBubbleModel : public TranslateBubbleModel {
view_state_transition_.SetViewState(view_state);
}
+ virtual TranslateErrors::Type GetErrorType() const OVERRIDE {
+ return error_type_;
+ }
+
+ virtual void SetErrorType(TranslateErrors::Type error_type) OVERRIDE {
+ error_type_ = error_type;
+ }
+
virtual void GoBackFromAdvanced() OVERRIDE {
view_state_transition_.GoBackFromAdvanced();
}
@@ -97,6 +106,7 @@ class MockTranslateBubbleModel : public TranslateBubbleModel {
}
TranslateBubbleViewStateTransition view_state_transition_;
+ TranslateErrors::Type error_type_;
int original_language_index_;
int target_language_index_;
bool never_translate_language_;
@@ -178,6 +188,9 @@ TEST_F(TranslateBubbleViewTest, ShowOriginalButton) {
TEST_F(TranslateBubbleViewTest, TryAgainButton) {
bubble_->SwitchView(TranslateBubbleModel::VIEW_STATE_ERROR);
+ bubble_->model()->SetErrorType(TranslateErrors::NETWORK);
+
+ EXPECT_EQ(TranslateErrors::NETWORK, bubble_->model()->GetErrorType());
// Click the "Try again" button to translate.
EXPECT_FALSE(mock_model_->translate_called_);
« no previous file with comments | « chrome/browser/ui/views/translate/translate_bubble_view.cc ('k') | chrome/test/base/test_browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698