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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/translate/chrome_translate_client.h" | 12 #include "chrome/browser/translate/chrome_translate_client.h" |
13 #include "chrome/browser/translate/cld_data_harness.h" | |
14 #include "chrome/browser/translate/cld_data_harness_factory.h" | |
15 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_commands.h" | 14 #include "chrome/browser/ui/browser_commands.h" |
17 #include "chrome/browser/ui/browser_tabstrip.h" | 15 #include "chrome/browser/ui/browser_tabstrip.h" |
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
19 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
21 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
22 #include "components/translate/core/common/language_detection_details.h" | 20 #include "components/translate/core/common/language_detection_details.h" |
23 #include "content/public/browser/notification_details.h" | 21 #include "content/public/browser/notification_details.h" |
24 | 22 |
25 class TranslateBubbleViewBrowserTest : public InProcessBrowserTest { | 23 class TranslateBubbleViewBrowserTest : public InProcessBrowserTest { |
26 public: | 24 public: |
27 TranslateBubbleViewBrowserTest(): | 25 TranslateBubbleViewBrowserTest() {} |
28 cld_data_harness( | |
29 test::CldDataHarnessFactory::Get()->CreateCldDataHarness()) {} | |
30 ~TranslateBubbleViewBrowserTest() override {} | 26 ~TranslateBubbleViewBrowserTest() override {} |
31 void SetUpOnMainThread() override { | 27 void SetUpOnMainThread() override { |
32 // We can't Init() until PathService has been initialized. This happens | |
33 // very late in the test fixture setup process. | |
34 cld_data_harness->Init(); | |
35 InProcessBrowserTest::SetUpOnMainThread(); | 28 InProcessBrowserTest::SetUpOnMainThread(); |
36 } | 29 } |
37 | 30 |
38 private: | 31 private: |
39 std::unique_ptr<test::CldDataHarness> cld_data_harness; | |
40 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleViewBrowserTest); | 32 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleViewBrowserTest); |
41 }; | 33 }; |
42 | 34 |
43 // Flaky: crbug.com/394066 | 35 // Flaky: crbug.com/394066 |
44 IN_PROC_BROWSER_TEST_F(TranslateBubbleViewBrowserTest, | 36 IN_PROC_BROWSER_TEST_F(TranslateBubbleViewBrowserTest, |
45 DISABLED_CloseBrowserWithoutTranslating) { | 37 DISABLED_CloseBrowserWithoutTranslating) { |
46 EXPECT_FALSE(TranslateBubbleView::GetCurrentBubble()); | 38 EXPECT_FALSE(TranslateBubbleView::GetCurrentBubble()); |
47 | 39 |
48 // Show a French page and wait until the bubble is shown. | 40 // Show a French page and wait until the bubble is shown. |
49 content::WebContents* current_web_contents = | 41 content::WebContents* current_web_contents = |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 chrome::CloseWebContents(browser(), web_contents, false); | 105 chrome::CloseWebContents(browser(), web_contents, false); |
114 EXPECT_EQ(active_index, browser()->tab_strip_model()->active_index()); | 106 EXPECT_EQ(active_index, browser()->tab_strip_model()->active_index()); |
115 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 107 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
116 EXPECT_FALSE(TranslateBubbleView::GetCurrentBubble()); | 108 EXPECT_FALSE(TranslateBubbleView::GetCurrentBubble()); |
117 | 109 |
118 // Close the last tab. | 110 // Close the last tab. |
119 chrome::CloseWebContents(browser(), | 111 chrome::CloseWebContents(browser(), |
120 browser()->tab_strip_model()->GetActiveWebContents(), | 112 browser()->tab_strip_model()->GetActiveWebContents(), |
121 false); | 113 false); |
122 } | 114 } |
OLD | NEW |