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

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

Issue 378253002: Fix translate namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing android build errors Created 6 years, 5 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
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 "base/memory/scoped_ptr.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/translate/cld_data_harness.h" 10 #include "chrome/browser/translate/cld_data_harness.h"
(...skipping 27 matching lines...) Expand all
38 // Flaky: crbug.com/394066 38 // Flaky: crbug.com/394066
39 IN_PROC_BROWSER_TEST_F(TranslateBubbleViewBrowserTest, 39 IN_PROC_BROWSER_TEST_F(TranslateBubbleViewBrowserTest,
40 DISABLED_CloseBrowserWithoutTranslating) { 40 DISABLED_CloseBrowserWithoutTranslating) {
41 EXPECT_FALSE(TranslateBubbleView::IsShowing()); 41 EXPECT_FALSE(TranslateBubbleView::IsShowing());
42 42
43 // Show a French page and wait until the bubble is shown. 43 // Show a French page and wait until the bubble is shown.
44 content::WebContents* current_web_contents = 44 content::WebContents* current_web_contents =
45 browser()->tab_strip_model()->GetActiveWebContents(); 45 browser()->tab_strip_model()->GetActiveWebContents();
46 content::Source<content::WebContents> source(current_web_contents); 46 content::Source<content::WebContents> source(current_web_contents);
47 ui_test_utils::WindowedNotificationObserverWithDetails< 47 ui_test_utils::WindowedNotificationObserverWithDetails<
48 LanguageDetectionDetails> 48 translate::LanguageDetectionDetails>
49 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, 49 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
50 source); 50 source);
51 GURL french_url = ui_test_utils::GetTestUrl( 51 GURL french_url = ui_test_utils::GetTestUrl(
52 base::FilePath(), base::FilePath(FILE_PATH_LITERAL("french_page.html"))); 52 base::FilePath(), base::FilePath(FILE_PATH_LITERAL("french_page.html")));
53 ui_test_utils::NavigateToURL(browser(), french_url); 53 ui_test_utils::NavigateToURL(browser(), french_url);
54 fr_language_detected_signal.Wait(); 54 fr_language_detected_signal.Wait();
55 EXPECT_TRUE(TranslateBubbleView::IsShowing()); 55 EXPECT_TRUE(TranslateBubbleView::IsShowing());
56 56
57 // Close the window without translating. 57 // Close the window without translating.
58 chrome::CloseWindow(browser()); 58 chrome::CloseWindow(browser());
59 EXPECT_FALSE(TranslateBubbleView::IsShowing()); 59 EXPECT_FALSE(TranslateBubbleView::IsShowing());
60 } 60 }
61 61
62 IN_PROC_BROWSER_TEST_F(TranslateBubbleViewBrowserTest, 62 IN_PROC_BROWSER_TEST_F(TranslateBubbleViewBrowserTest,
63 CloseLastTabWithoutTranslating) { 63 CloseLastTabWithoutTranslating) {
64 EXPECT_FALSE(TranslateBubbleView::IsShowing()); 64 EXPECT_FALSE(TranslateBubbleView::IsShowing());
65 65
66 // Show a French page and wait until the bubble is shown. 66 // Show a French page and wait until the bubble is shown.
67 content::WebContents* current_web_contents = 67 content::WebContents* current_web_contents =
68 browser()->tab_strip_model()->GetActiveWebContents(); 68 browser()->tab_strip_model()->GetActiveWebContents();
69 content::Source<content::WebContents> source(current_web_contents); 69 content::Source<content::WebContents> source(current_web_contents);
70 ui_test_utils::WindowedNotificationObserverWithDetails< 70 ui_test_utils::WindowedNotificationObserverWithDetails<
71 LanguageDetectionDetails> 71 translate::LanguageDetectionDetails>
72 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, 72 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
73 source); 73 source);
74 GURL french_url = ui_test_utils::GetTestUrl( 74 GURL french_url = ui_test_utils::GetTestUrl(
75 base::FilePath(), base::FilePath(FILE_PATH_LITERAL("french_page.html"))); 75 base::FilePath(), base::FilePath(FILE_PATH_LITERAL("french_page.html")));
76 ui_test_utils::NavigateToURL(browser(), french_url); 76 ui_test_utils::NavigateToURL(browser(), french_url);
77 fr_language_detected_signal.Wait(); 77 fr_language_detected_signal.Wait();
78 EXPECT_TRUE(TranslateBubbleView::IsShowing()); 78 EXPECT_TRUE(TranslateBubbleView::IsShowing());
79 79
80 // Close the tab without translating. 80 // Close the tab without translating.
81 EXPECT_EQ(1, browser()->tab_strip_model()->count()); 81 EXPECT_EQ(1, browser()->tab_strip_model()->count());
(...skipping 13 matching lines...) Expand all
95 base::FilePath(), base::FilePath(FILE_PATH_LITERAL("french_page.html"))); 95 base::FilePath(), base::FilePath(FILE_PATH_LITERAL("french_page.html")));
96 chrome::AddTabAt(browser(), french_url, french_index, false); 96 chrome::AddTabAt(browser(), french_url, french_index, false);
97 EXPECT_EQ(active_index, browser()->tab_strip_model()->active_index()); 97 EXPECT_EQ(active_index, browser()->tab_strip_model()->active_index());
98 EXPECT_EQ(2, browser()->tab_strip_model()->count()); 98 EXPECT_EQ(2, browser()->tab_strip_model()->count());
99 99
100 // Wait until the language is detected. 100 // Wait until the language is detected.
101 content::WebContents* web_contents = 101 content::WebContents* web_contents =
102 browser()->tab_strip_model()->GetWebContentsAt(french_index); 102 browser()->tab_strip_model()->GetWebContentsAt(french_index);
103 content::Source<content::WebContents> source(web_contents); 103 content::Source<content::WebContents> source(web_contents);
104 ui_test_utils::WindowedNotificationObserverWithDetails< 104 ui_test_utils::WindowedNotificationObserverWithDetails<
105 LanguageDetectionDetails> 105 translate::LanguageDetectionDetails>
106 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, 106 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
107 source); 107 source);
108 fr_language_detected_signal.Wait(); 108 fr_language_detected_signal.Wait();
109 109
110 // The bubble is not shown because the tab is not activated. 110 // The bubble is not shown because the tab is not activated.
111 EXPECT_FALSE(TranslateBubbleView::IsShowing()); 111 EXPECT_FALSE(TranslateBubbleView::IsShowing());
112 112
113 // Close the French page tab immediately. 113 // Close the French page tab immediately.
114 chrome::CloseWebContents(browser(), web_contents, false); 114 chrome::CloseWebContents(browser(), web_contents, false);
115 EXPECT_EQ(active_index, browser()->tab_strip_model()->active_index()); 115 EXPECT_EQ(active_index, browser()->tab_strip_model()->active_index());
116 EXPECT_EQ(1, browser()->tab_strip_model()->count()); 116 EXPECT_EQ(1, browser()->tab_strip_model()->count());
117 EXPECT_FALSE(TranslateBubbleView::IsShowing()); 117 EXPECT_FALSE(TranslateBubbleView::IsShowing());
118 118
119 // Close the last tab. 119 // Close the last tab.
120 chrome::CloseWebContents(browser(), 120 chrome::CloseWebContents(browser(),
121 browser()->tab_strip_model()->GetActiveWebContents(), 121 browser()->tab_strip_model()->GetActiveWebContents(),
122 false); 122 false);
123 } 123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698