OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/cocoa/translate/translate_bubble_controller.h" | 5 #include "chrome/browser/ui/cocoa/translate/translate_bubble_controller.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #import "chrome/browser/ui/browser.h" | 8 #import "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 10 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
11 #import "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 11 #import "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
12 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 12 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
13 #import "chrome/browser/ui/cocoa/run_loop_testing.h" | 13 #import "chrome/browser/ui/cocoa/run_loop_testing.h" |
14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
15 #include "content/public/browser/site_instance.h" | 15 #include "content/public/browser/site_instance.h" |
16 | 16 |
17 @implementation BrowserWindowController (ForTesting) | 17 @implementation BrowserWindowController (ForTesting) |
18 | 18 |
19 - (TranslateBubbleController*)translateBubbleController{ | 19 - (TranslateBubbleController*)translateBubbleController{ |
20 return translateBubbleController_; | 20 return translateBubbleController_; |
21 } | 21 } |
22 | 22 |
23 @end | 23 @end |
24 | 24 |
25 class TranslateBubbleControllerTest : public CocoaProfileTest { | 25 class TranslateBubbleControllerTest : public CocoaProfileTest { |
26 public: | 26 public: |
27 virtual void SetUp() OVERRIDE { | 27 virtual void SetUp() override { |
28 CocoaProfileTest::SetUp(); | 28 CocoaProfileTest::SetUp(); |
29 site_instance_ = content::SiteInstance::Create(profile()); | 29 site_instance_ = content::SiteInstance::Create(profile()); |
30 } | 30 } |
31 | 31 |
32 content::WebContents* AppendToTabStrip() { | 32 content::WebContents* AppendToTabStrip() { |
33 content::WebContents* web_contents = content::WebContents::Create( | 33 content::WebContents* web_contents = content::WebContents::Create( |
34 content::WebContents::CreateParams(profile(), site_instance_.get())); | 34 content::WebContents::CreateParams(profile(), site_instance_.get())); |
35 browser()->tab_strip_model()->AppendWebContents( | 35 browser()->tab_strip_model()->AppendWebContents( |
36 web_contents, /*foreground=*/true); | 36 web_contents, /*foreground=*/true); |
37 return web_contents; | 37 return web_contents; |
(...skipping 19 matching lines...) Expand all Loading... |
57 bubble = [bwc translateBubbleController]; | 57 bubble = [bwc translateBubbleController]; |
58 EXPECT_TRUE(bubble); | 58 EXPECT_TRUE(bubble); |
59 InfoBubbleWindow* window = (InfoBubbleWindow*)[bubble window]; | 59 InfoBubbleWindow* window = (InfoBubbleWindow*)[bubble window]; |
60 [window setAllowedAnimations:info_bubble::kAnimateNone]; | 60 [window setAllowedAnimations:info_bubble::kAnimateNone]; |
61 | 61 |
62 [bubble close]; | 62 [bubble close]; |
63 chrome::testing::NSRunLoopRunAllPending(); | 63 chrome::testing::NSRunLoopRunAllPending(); |
64 bubble = [bwc translateBubbleController]; | 64 bubble = [bwc translateBubbleController]; |
65 EXPECT_FALSE(bubble); | 65 EXPECT_FALSE(bubble); |
66 } | 66 } |
OLD | NEW |