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

Side by Side Diff: chrome/browser/ui/views/translate/translate_bubble_view_browsertest.cc

Issue 333603002: Modularize Compact Language Detector 2 (CLD2) data sources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge https://codereview.chromium.org/326383005 Created 6 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser_browsertest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/memory/scoped_ptr.h"
8 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/translate/translate_browser_test_utils.h" 10 #include "chrome/browser/translate/cld_data_harness.h"
10 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_commands.h" 12 #include "chrome/browser/ui/browser_commands.h"
12 #include "chrome/browser/ui/browser_tabstrip.h" 13 #include "chrome/browser/ui/browser_tabstrip.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
15 #include "chrome/test/base/in_process_browser_test.h" 16 #include "chrome/test/base/in_process_browser_test.h"
16 #include "chrome/test/base/ui_test_utils.h" 17 #include "chrome/test/base/ui_test_utils.h"
17 #include "components/translate/core/common/language_detection_details.h" 18 #include "components/translate/core/common/language_detection_details.h"
18 #include "content/public/browser/notification_details.h" 19 #include "content/public/browser/notification_details.h"
19 20
20 class TranslateBubbleViewBrowserTest : public InProcessBrowserTest { 21 class TranslateBubbleViewBrowserTest : public InProcessBrowserTest {
21 public: 22 public:
22 TranslateBubbleViewBrowserTest() {} 23 TranslateBubbleViewBrowserTest()
24 : cld_data_harness(test::CreateCldDataHarness()) {}
23 virtual ~TranslateBubbleViewBrowserTest() {} 25 virtual ~TranslateBubbleViewBrowserTest() {}
24 virtual void SetUpOnMainThread() OVERRIDE { 26 virtual void SetUpOnMainThread() OVERRIDE {
25 // We can't Init() until PathService has been initialized. This happens 27 // We can't Init() until PathService has been initialized. This happens
26 // very late in the test fixture setup process. 28 // very late in the test fixture setup process.
27 dynamic_data_scope.Init(); 29 cld_data_harness->Init();
28 InProcessBrowserTest::SetUpOnMainThread(); 30 InProcessBrowserTest::SetUpOnMainThread();
29 } 31 }
30 32
31 private: 33 private:
32 test::ScopedCLDDynamicDataHarness dynamic_data_scope; 34 scoped_ptr<test::CldDataHarness> cld_data_harness;
33 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleViewBrowserTest); 35 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleViewBrowserTest);
34 }; 36 };
35 37
36 IN_PROC_BROWSER_TEST_F(TranslateBubbleViewBrowserTest, 38 IN_PROC_BROWSER_TEST_F(TranslateBubbleViewBrowserTest,
37 CloseBrowserWithoutTranslating) { 39 CloseBrowserWithoutTranslating) {
38 EXPECT_FALSE(TranslateBubbleView::IsShowing()); 40 EXPECT_FALSE(TranslateBubbleView::IsShowing());
39 41
40 // Show a French page and wait until the bubble is shown. 42 // Show a French page and wait until the bubble is shown.
41 content::WebContents* current_web_contents = 43 content::WebContents* current_web_contents =
42 browser()->tab_strip_model()->GetActiveWebContents(); 44 browser()->tab_strip_model()->GetActiveWebContents();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 chrome::CloseWebContents(browser(), web_contents, false); 113 chrome::CloseWebContents(browser(), web_contents, false);
112 EXPECT_EQ(active_index, browser()->tab_strip_model()->active_index()); 114 EXPECT_EQ(active_index, browser()->tab_strip_model()->active_index());
113 EXPECT_EQ(1, browser()->tab_strip_model()->count()); 115 EXPECT_EQ(1, browser()->tab_strip_model()->count());
114 EXPECT_FALSE(TranslateBubbleView::IsShowing()); 116 EXPECT_FALSE(TranslateBubbleView::IsShowing());
115 117
116 // Close the last tab. 118 // Close the last tab.
117 chrome::CloseWebContents(browser(), 119 chrome::CloseWebContents(browser(),
118 browser()->tab_strip_model()->GetActiveWebContents(), 120 browser()->tab_strip_model()->GetActiveWebContents(),
119 false); 121 false);
120 } 122 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_browsertest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698