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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/translate/translate_browser_test_utils.h" | |
9 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_commands.h" | 11 #include "chrome/browser/ui/browser_commands.h" |
11 #include "chrome/browser/ui/browser_tabstrip.h" | 12 #include "chrome/browser/ui/browser_tabstrip.h" |
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
13 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
16 #include "components/translate/core/common/language_detection_details.h" | 17 #include "components/translate/core/common/language_detection_details.h" |
17 #include "content/public/browser/notification_details.h" | 18 #include "content/public/browser/notification_details.h" |
18 | 19 |
19 class TranslateBubbleViewBrowserTest : public InProcessBrowserTest { | 20 class TranslateBubbleViewBrowserTest : public InProcessBrowserTest { |
20 public: | 21 public: |
21 TranslateBubbleViewBrowserTest() {} | 22 TranslateBubbleViewBrowserTest() {} |
22 virtual ~TranslateBubbleViewBrowserTest() {} | 23 virtual ~TranslateBubbleViewBrowserTest() {} |
24 bool SetUpUserDataDirectory() OVERRIDE { | |
msw
2014/05/21 17:08:32
nit: virtual
| |
25 if (!InProcessBrowserTest::SetUpUserDataDirectory()) | |
26 return false; | |
27 dynamic_data_scope.Init(); | |
28 return !(::testing::Test::HasFatalFailure()); | |
msw
2014/05/21 17:08:32
nit: I think you can just return !HasFatalFailure(
| |
29 } | |
23 | 30 |
24 private: | 31 private: |
32 test::ScopedCLDDynamicDataHarness dynamic_data_scope; | |
25 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleViewBrowserTest); | 33 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleViewBrowserTest); |
26 }; | 34 }; |
27 | 35 |
28 IN_PROC_BROWSER_TEST_F(TranslateBubbleViewBrowserTest, | 36 IN_PROC_BROWSER_TEST_F(TranslateBubbleViewBrowserTest, |
29 CloseBrowserWithoutTranslating) { | 37 CloseBrowserWithoutTranslating) { |
30 EXPECT_FALSE(TranslateBubbleView::IsShowing()); | 38 EXPECT_FALSE(TranslateBubbleView::IsShowing()); |
31 | 39 |
32 // Show a French page and wait until the bubble is shown. | 40 // Show a French page and wait until the bubble is shown. |
33 content::WebContents* current_web_contents = | 41 content::WebContents* current_web_contents = |
34 browser()->tab_strip_model()->GetActiveWebContents(); | 42 browser()->tab_strip_model()->GetActiveWebContents(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 chrome::CloseWebContents(browser(), web_contents, false); | 111 chrome::CloseWebContents(browser(), web_contents, false); |
104 EXPECT_EQ(active_index, browser()->tab_strip_model()->active_index()); | 112 EXPECT_EQ(active_index, browser()->tab_strip_model()->active_index()); |
105 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 113 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
106 EXPECT_FALSE(TranslateBubbleView::IsShowing()); | 114 EXPECT_FALSE(TranslateBubbleView::IsShowing()); |
107 | 115 |
108 // Close the last tab. | 116 // Close the last tab. |
109 chrome::CloseWebContents(browser(), | 117 chrome::CloseWebContents(browser(), |
110 browser()->tab_strip_model()->GetActiveWebContents(), | 118 browser()->tab_strip_model()->GetActiveWebContents(), |
111 false); | 119 false); |
112 } | 120 } |
OLD | NEW |