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

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: Use base/memory/scoped_ptr.h, not base/scoped_ptr.h 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
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/scoped_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_scope(test::CreateScopedCldDataHarness()) {
25 }
23 virtual ~TranslateBubbleViewBrowserTest() {} 26 virtual ~TranslateBubbleViewBrowserTest() {}
24 virtual void SetUpOnMainThread() OVERRIDE { 27 virtual void SetUpOnMainThread() OVERRIDE {
25 // We can't Init() until PathService has been initialized. This happens 28 // We can't Init() until PathService has been initialized. This happens
26 // very late in the test fixture setup process. 29 // very late in the test fixture setup process.
27 dynamic_data_scope.Init(); 30 cld_data_scope->Init();
28 InProcessBrowserTest::SetUpOnMainThread(); 31 InProcessBrowserTest::SetUpOnMainThread();
29 } 32 }
30 33
31 private: 34 private:
32 test::ScopedCLDDynamicDataHarness dynamic_data_scope; 35 scoped_ptr<test::ScopedCldDataHarness> cld_data_scope;
33 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleViewBrowserTest); 36 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleViewBrowserTest);
34 }; 37 };
35 38
36 IN_PROC_BROWSER_TEST_F(TranslateBubbleViewBrowserTest, 39 IN_PROC_BROWSER_TEST_F(TranslateBubbleViewBrowserTest,
37 CloseBrowserWithoutTranslating) { 40 CloseBrowserWithoutTranslating) {
38 EXPECT_FALSE(TranslateBubbleView::IsShowing()); 41 EXPECT_FALSE(TranslateBubbleView::IsShowing());
39 42
40 // Show a French page and wait until the bubble is shown. 43 // Show a French page and wait until the bubble is shown.
41 content::WebContents* current_web_contents = 44 content::WebContents* current_web_contents =
42 browser()->tab_strip_model()->GetActiveWebContents(); 45 browser()->tab_strip_model()->GetActiveWebContents();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 chrome::CloseWebContents(browser(), web_contents, false); 114 chrome::CloseWebContents(browser(), web_contents, false);
112 EXPECT_EQ(active_index, browser()->tab_strip_model()->active_index()); 115 EXPECT_EQ(active_index, browser()->tab_strip_model()->active_index());
113 EXPECT_EQ(1, browser()->tab_strip_model()->count()); 116 EXPECT_EQ(1, browser()->tab_strip_model()->count());
114 EXPECT_FALSE(TranslateBubbleView::IsShowing()); 117 EXPECT_FALSE(TranslateBubbleView::IsShowing());
115 118
116 // Close the last tab. 119 // Close the last tab.
117 chrome::CloseWebContents(browser(), 120 chrome::CloseWebContents(browser(),
118 browser()->tab_strip_model()->GetActiveWebContents(), 121 browser()->tab_strip_model()->GetActiveWebContents(),
119 false); 122 false);
120 } 123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698