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

Side by Side Diff: chrome/browser/translate/translate_manager_browsertest.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 }; 331 };
332 332
333 class MockTranslateBubbleFactory : public TranslateBubbleFactory { 333 class MockTranslateBubbleFactory : public TranslateBubbleFactory {
334 public: 334 public:
335 MockTranslateBubbleFactory() { 335 MockTranslateBubbleFactory() {
336 } 336 }
337 337
338 virtual void ShowImplementation( 338 virtual void ShowImplementation(
339 BrowserWindow* window, 339 BrowserWindow* window,
340 content::WebContents* web_contents, 340 content::WebContents* web_contents,
341 TranslateBubbleModel::ViewState view_state) OVERRIDE { 341 TranslateBubbleModel::ViewState view_state,
342 TranslateErrors::Type error_type) OVERRIDE {
342 if (model_) { 343 if (model_) {
343 model_->SetViewState(view_state); 344 model_->SetViewState(view_state);
344 return; 345 return;
345 } 346 }
346 347
347 TranslateTabHelper* translate_tab_helper = 348 TranslateTabHelper* translate_tab_helper =
348 TranslateTabHelper::FromWebContents(web_contents); 349 TranslateTabHelper::FromWebContents(web_contents);
349 std::string source_language = 350 std::string source_language =
350 translate_tab_helper->language_state().original_language(); 351 translate_tab_helper->language_state().original_language();
351 std::string target_language = TranslateManager::GetLanguageCode( 352 std::string target_language = TranslateManager::GetLanguageCode(
352 g_browser_process->GetApplicationLocale()); 353 g_browser_process->GetApplicationLocale());
353 scoped_ptr<TranslateUIDelegate> ui_delegate( 354 scoped_ptr<TranslateUIDelegate> ui_delegate(
354 new TranslateUIDelegate(web_contents, 355 new TranslateUIDelegate(web_contents,
355 source_language, 356 source_language,
356 target_language)); 357 target_language,
358 error_type));
357 model_.reset( 359 model_.reset(
358 new TranslateBubbleModelImpl(view_state, ui_delegate.Pass())); 360 new TranslateBubbleModelImpl(view_state, ui_delegate.Pass()));
359 } 361 }
360 362
361 TranslateBubbleModel* model() { return model_.get(); } 363 TranslateBubbleModel* model() { return model_.get(); }
362 364
363 private: 365 private:
364 scoped_ptr<TranslateBubbleModel> model_; 366 scoped_ptr<TranslateBubbleModel> model_;
365 367
366 DISALLOW_COPY_AND_ASSIGN(MockTranslateBubbleFactory); 368 DISALLOW_COPY_AND_ASSIGN(MockTranslateBubbleFactory);
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 content::WebContents* current_web_contents = 1618 content::WebContents* current_web_contents =
1617 browser()->tab_strip_model()->GetActiveWebContents(); 1619 browser()->tab_strip_model()->GetActiveWebContents();
1618 content::Source<content::WebContents> source(current_web_contents); 1620 content::Source<content::WebContents> source(current_web_contents);
1619 1621
1620 ui_test_utils::WindowedNotificationObserverWithDetails< 1622 ui_test_utils::WindowedNotificationObserverWithDetails<
1621 LanguageDetectionDetails> 1623 LanguageDetectionDetails>
1622 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, 1624 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
1623 source); 1625 source);
1624 fr_language_detected_signal.Wait(); 1626 fr_language_detected_signal.Wait();
1625 } 1627 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698