1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/translate/translate_bubble_test_utils.h"
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_window.h"
9 #include "chrome/browser/ui/cocoa/browser_window_controller.h"
10 #include "chrome/browser/ui/cocoa/translate/translate_bubble_controller.h"
11 #include "chrome/browser/ui/translate/translate_bubble_model.h"
13 // TODO(groby): Share with translate_bubble_controller_unittest.mm
14 @implementation BrowserWindowController (ForTesting)
16 - (TranslateBubbleController*)translateBubbleController {
17 return translateBubbleController_;
24 namespace test_utils {
26 const TranslateBubbleModel* GetCurrentModel(Browser* browser) {
28 NSWindow* native_window = browser->window()->GetNativeWindow();
29 BrowserWindowController* controller =
30 [BrowserWindowController browserWindowControllerForWindow:native_window];
31 return [[controller translateBubbleController] model];
34 void PressTranslate(Browser* browser) {
36 NSWindow* native_window = browser->window()->GetNativeWindow();
37 BrowserWindowController* controller =
38 [BrowserWindowController browserWindowControllerForWindow:native_window];
39 [[controller translateBubbleController] handleTranslateButtonPressed];
42 } // namespace test_utils
44 } // namespace translate