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

Side by Side Diff: chrome/browser/translate/translate_browsertest.cc

Issue 14180010: Translate: browser test for Chrome Translate in an isolated world (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (rebase: similarity=90) Created 7 years, 4 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 }; // namespace 43 }; // namespace
44 44
45 class TranslateBrowserTest : public InProcessBrowserTest { 45 class TranslateBrowserTest : public InProcessBrowserTest {
46 public: 46 public:
47 TranslateBrowserTest() 47 TranslateBrowserTest()
48 : https_server_(net::SpawnedTestServer::TYPE_HTTPS, 48 : https_server_(net::SpawnedTestServer::TYPE_HTTPS,
49 SSLOptions(SSLOptions::CERT_OK), 49 SSLOptions(SSLOptions::CERT_OK),
50 base::FilePath(kTranslateRoot)) {} 50 base::FilePath(kTranslateRoot)) {}
51 51
52 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 52 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
53 ASSERT_TRUE(https_server_.Start()); 53 ASSERT_TRUE(https_server_.Start());
54 // Setup altenate security-origin for testing.
55 GURL origin = GetSecureURL("");
56 command_line->AppendSwitchASCII(switches::kTranslateSecurityOrigin,
57 origin.spec());
54 } 58 }
55 59
56 protected: 60 protected:
57 GURL GetNonSecureURL(const std::string& path) const { 61 GURL GetNonSecureURL(const std::string& path) const {
58 std::string prefix(kNonSecurePrefix); 62 std::string prefix(kNonSecurePrefix);
59 return embedded_test_server()->GetURL(prefix + path); 63 return embedded_test_server()->GetURL(prefix + path);
60 } 64 }
61 65
62 GURL GetSecureURL(const std::string& path) const { 66 GURL GetSecureURL(const std::string& path) const {
63 std::string prefix(kSecurePrefix); 67 std::string prefix(kSecurePrefix);
64 return https_server_.GetURL(prefix + path); 68 return https_server_.GetURL(prefix + path);
65 } 69 }
66 70
67 private: 71 private:
68 net::SpawnedTestServer https_server_; 72 net::SpawnedTestServer https_server_;
69 73
70 typedef net::SpawnedTestServer::SSLOptions SSLOptions; 74 typedef net::SpawnedTestServer::SSLOptions SSLOptions;
71 75
72 DISALLOW_COPY_AND_ASSIGN(TranslateBrowserTest); 76 DISALLOW_COPY_AND_ASSIGN(TranslateBrowserTest);
73 }; 77 };
74 78
75 // TODO(toyoshim): This test should be changed to work in an isolated world. 79 IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, TranslateInIsolatedWorld) {
76 // See also http://crbug.com/164547 .
77 IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, DISABLED_Translate) {
78 #if defined(OS_WIN) && defined(USE_ASH) 80 #if defined(OS_WIN) && defined(USE_ASH)
79 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 81 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
80 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 82 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
81 return; 83 return;
82 #endif 84 #endif
83 85
84 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 86 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
85 87
86 content::WebContents* web_contents = 88 content::WebContents* web_contents =
87 browser()->tab_strip_model()->GetActiveWebContents(); 89 browser()->tab_strip_model()->GetActiveWebContents();
88 ASSERT_TRUE(web_contents); 90 ASSERT_TRUE(web_contents);
89 91
90 net::TestURLFetcherFactory factory; 92 net::TestURLFetcherFactory factory;
91 93
92 // Setup infobar observer. 94 // Setup infobar observer.
93 InfoBarService* infobar_service = 95 InfoBarService* infobar_service =
94 InfoBarService::FromWebContents(web_contents); 96 InfoBarService::FromWebContents(web_contents);
95 ASSERT_TRUE(infobar_service); 97 ASSERT_TRUE(infobar_service);
96 EXPECT_EQ(0U, infobar_service->infobar_count()); 98 EXPECT_EQ(1U, infobar_service->infobar_count());
99 ConfirmInfoBarDelegate* confirm =
100 infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
101 EXPECT_TRUE(confirm);
hajimehoshi 2013/07/31 06:59:23 Please add comment to explain why the confirm info
97 content::WindowedNotificationObserver infobar( 102 content::WindowedNotificationObserver infobar(
98 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, 103 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
99 content::NotificationService::AllSources()); 104 content::NotificationService::AllSources());
100 105
101 // Setup page title observer. 106 // Setup page title observer.
102 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS")); 107 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS"));
103 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 108 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
104 109
105 // Visit non-secure page which is going to be translated. 110 // Visit non-secure page which is going to be translated.
106 ui_test_utils::NavigateToURL(browser(), GetNonSecureURL(kFrenchTestPath)); 111 ui_test_utils::NavigateToURL(browser(), GetNonSecureURL(kFrenchTestPath));
107 112
108 // Wait for Chrome Translate infobar. 113 // Wait for Chrome Translate infobar.
109 infobar.Wait(); 114 infobar.Wait();
110 115
111 // Perform Chrome Translate. 116 // Perform Chrome Translate.
112 ASSERT_EQ(1U, infobar_service->infobar_count()); 117 ASSERT_EQ(2U, infobar_service->infobar_count());
118 confirm = infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
119 EXPECT_TRUE(confirm);
120
113 TranslateInfoBarDelegate* translate = 121 TranslateInfoBarDelegate* translate =
114 infobar_service->infobar_at(0)->AsTranslateInfoBarDelegate(); 122 infobar_service->infobar_at(1)->AsTranslateInfoBarDelegate();
115 ASSERT_TRUE(translate); 123 ASSERT_TRUE(translate);
116 translate->Translate(); 124 translate->Translate();
117 125
118 // Hook URLFetcher for element.js. 126 // Hook URLFetcher for element.js.
119 GURL script1_url = GetSecureURL(kMainScriptPath); 127 GURL script1_url = GetSecureURL(kMainScriptPath);
120 GURL script2_url = GetSecureURL(kElementMainScriptPath); 128 GURL script2_url = GetSecureURL(kElementMainScriptPath);
121 std::string element_js = "main_script_url = '" + script1_url.spec() + "';\n"; 129 std::string element_js = "main_script_url = '" + script1_url.spec() + "';\n";
122 element_js += "element_main_script_url = '" + script2_url.spec() + "';\n"; 130 element_js += "element_main_script_url = '" + script2_url.spec() + "';\n";
123 element_js += 131 element_js +=
124 "google = { 'translate' : { 'TranslateService' : function() { return {\n" 132 "google = { 'translate' : { 'TranslateService' : function() { return {\n"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 166 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
159 167
160 content::WebContents* web_contents = 168 content::WebContents* web_contents =
161 browser()->tab_strip_model()->GetActiveWebContents(); 169 browser()->tab_strip_model()->GetActiveWebContents();
162 ASSERT_TRUE(web_contents); 170 ASSERT_TRUE(web_contents);
163 171
164 // Check infobar count. 172 // Check infobar count.
165 InfoBarService* infobar_service = 173 InfoBarService* infobar_service =
166 InfoBarService::FromWebContents(web_contents); 174 InfoBarService::FromWebContents(web_contents);
167 ASSERT_TRUE(infobar_service); 175 ASSERT_TRUE(infobar_service);
168 EXPECT_EQ(0U, infobar_service->infobar_count()); 176 EXPECT_EQ(1U, infobar_service->infobar_count());
177 ConfirmInfoBarDelegate* confirm =
178 infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
179 EXPECT_TRUE(confirm);
169 180
170 // Setup page title observer. 181 // Setup page title observer.
171 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS")); 182 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS"));
172 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 183 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
173 184
174 // Visit a test page. 185 // Visit a test page.
175 ui_test_utils::NavigateToURL( 186 ui_test_utils::NavigateToURL(
176 browser(), 187 browser(),
177 GetNonSecureURL(kRefreshMetaTagTestPath)); 188 GetNonSecureURL(kRefreshMetaTagTestPath));
178 189
179 // Wait for the page title is changed after the test finished. 190 // Wait for the page title is changed after the test finished.
180 const string16 result = watcher.WaitAndGetTitle(); 191 const string16 result = watcher.WaitAndGetTitle();
181 EXPECT_EQ("PASS", UTF16ToASCII(result)); 192 EXPECT_EQ("PASS", UTF16ToASCII(result));
182 193
183 // Check there is not infobar. 194 // Check there is not infobar.
184 EXPECT_EQ(0U, infobar_service->infobar_count()); 195 EXPECT_EQ(1U, infobar_service->infobar_count());
196 confirm = infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
197 EXPECT_TRUE(confirm);
185 } 198 }
186 199
187 IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, 200 IN_PROC_BROWSER_TEST_F(TranslateBrowserTest,
188 IgnoreRefreshMetaTagInCaseInsensitive) { 201 IgnoreRefreshMetaTagInCaseInsensitive) {
189 #if defined(OS_WIN) && defined(USE_ASH) 202 #if defined(OS_WIN) && defined(USE_ASH)
190 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 203 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
191 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 204 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
192 return; 205 return;
193 #endif 206 #endif
194 207
195 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 208 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
196 209
197 content::WebContents* web_contents = 210 content::WebContents* web_contents =
198 browser()->tab_strip_model()->GetActiveWebContents(); 211 browser()->tab_strip_model()->GetActiveWebContents();
199 ASSERT_TRUE(web_contents); 212 ASSERT_TRUE(web_contents);
200 213
201 // Check infobar count. 214 // Check infobar count.
202 InfoBarService* infobar_service = 215 InfoBarService* infobar_service =
203 InfoBarService::FromWebContents(web_contents); 216 InfoBarService::FromWebContents(web_contents);
204 ASSERT_TRUE(infobar_service); 217 ASSERT_TRUE(infobar_service);
205 EXPECT_EQ(0U, infobar_service->infobar_count()); 218 EXPECT_EQ(1U, infobar_service->infobar_count());
219 ConfirmInfoBarDelegate* confirm =
220 infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
221 EXPECT_TRUE(confirm);
hajimehoshi 2013/07/31 07:04:01 ditto
206 222
207 // Setup page title observer. 223 // Setup page title observer.
208 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS")); 224 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS"));
209 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 225 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
210 226
211 // Visit a test page. 227 // Visit a test page.
212 ui_test_utils::NavigateToURL( 228 ui_test_utils::NavigateToURL(
213 browser(), 229 browser(),
214 GetNonSecureURL(kRefreshMetaTagCaseInsensitiveTestPath)); 230 GetNonSecureURL(kRefreshMetaTagCaseInsensitiveTestPath));
215 231
216 // Wait for the page title is changed after the test finished. 232 // Wait for the page title is changed after the test finished.
217 const string16 result = watcher.WaitAndGetTitle(); 233 const string16 result = watcher.WaitAndGetTitle();
218 EXPECT_EQ("PASS", UTF16ToASCII(result)); 234 EXPECT_EQ("PASS", UTF16ToASCII(result));
219 235
220 // Check there is not infobar. 236 // Check there is not infobar.
221 EXPECT_EQ(0U, infobar_service->infobar_count()); 237 EXPECT_EQ(1U, infobar_service->infobar_count());
238 confirm = infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
239 EXPECT_TRUE(confirm);
222 } 240 }
223 241
224 IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, IgnoreRefreshMetaTagAtOnload) { 242 IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, IgnoreRefreshMetaTagAtOnload) {
225 #if defined(OS_WIN) && defined(USE_ASH) 243 #if defined(OS_WIN) && defined(USE_ASH)
226 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 244 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
227 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 245 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
228 return; 246 return;
229 #endif 247 #endif
230 248
231 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 249 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
232 250
233 content::WebContents* web_contents = 251 content::WebContents* web_contents =
234 browser()->tab_strip_model()->GetActiveWebContents(); 252 browser()->tab_strip_model()->GetActiveWebContents();
235 ASSERT_TRUE(web_contents); 253 ASSERT_TRUE(web_contents);
236 254
237 // Check infobar count. 255 // Check infobar count.
238 InfoBarService* infobar_service = 256 InfoBarService* infobar_service =
239 InfoBarService::FromWebContents(web_contents); 257 InfoBarService::FromWebContents(web_contents);
240 ASSERT_TRUE(infobar_service); 258 ASSERT_TRUE(infobar_service);
241 EXPECT_EQ(0U, infobar_service->infobar_count()); 259 EXPECT_EQ(1U, infobar_service->infobar_count());
260 ConfirmInfoBarDelegate* confirm =
261 infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
262 EXPECT_TRUE(confirm);
hajimehoshi 2013/07/31 07:04:01 ditto
242 263
243 // Setup page title observer. 264 // Setup page title observer.
244 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS")); 265 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS"));
245 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 266 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
246 267
247 // Visit a test page. 268 // Visit a test page.
248 ui_test_utils::NavigateToURL( 269 ui_test_utils::NavigateToURL(
249 browser(), 270 browser(),
250 GetNonSecureURL(kRefreshMetaTagAtOnloadTestPath)); 271 GetNonSecureURL(kRefreshMetaTagAtOnloadTestPath));
251 272
252 // Wait for the page title is changed after the test finished. 273 // Wait for the page title is changed after the test finished.
253 const string16 result = watcher.WaitAndGetTitle(); 274 const string16 result = watcher.WaitAndGetTitle();
254 EXPECT_EQ("PASS", UTF16ToASCII(result)); 275 EXPECT_EQ("PASS", UTF16ToASCII(result));
255 276
256 // Check there is not infobar. 277 // Check there is not infobar.
257 EXPECT_EQ(0U, infobar_service->infobar_count()); 278 EXPECT_EQ(1U, infobar_service->infobar_count());
279 confirm = infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
280 EXPECT_TRUE(confirm);
258 } 281 }
259 282
260 IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, UpdateLocation) { 283 IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, UpdateLocation) {
261 #if defined(OS_WIN) && defined(USE_ASH) 284 #if defined(OS_WIN) && defined(USE_ASH)
262 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 285 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
263 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 286 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
264 return; 287 return;
265 #endif 288 #endif
266 289
267 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 290 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
268 291
269 content::WebContents* web_contents = 292 content::WebContents* web_contents =
270 browser()->tab_strip_model()->GetActiveWebContents(); 293 browser()->tab_strip_model()->GetActiveWebContents();
271 ASSERT_TRUE(web_contents); 294 ASSERT_TRUE(web_contents);
272 295
273 // Check infobar count. 296 // Check infobar count.
274 InfoBarService* infobar_service = 297 InfoBarService* infobar_service =
275 InfoBarService::FromWebContents(web_contents); 298 InfoBarService::FromWebContents(web_contents);
276 ASSERT_TRUE(infobar_service); 299 ASSERT_TRUE(infobar_service);
277 EXPECT_EQ(0U, infobar_service->infobar_count()); 300 EXPECT_EQ(1U, infobar_service->infobar_count());
301 ConfirmInfoBarDelegate* confirm =
302 infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
303 EXPECT_TRUE(confirm);
hajimehoshi 2013/07/31 07:04:01 ditto
278 304
279 // Setup page title observer. 305 // Setup page title observer.
280 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS")); 306 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS"));
281 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 307 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
282 308
283 // Visit a test page. 309 // Visit a test page.
284 ui_test_utils::NavigateToURL( 310 ui_test_utils::NavigateToURL(
285 browser(), 311 browser(),
286 GetNonSecureURL(kUpdateLocationTestPath)); 312 GetNonSecureURL(kUpdateLocationTestPath));
287 313
288 // Wait for the page title is changed after the test finished. 314 // Wait for the page title is changed after the test finished.
289 const string16 result = watcher.WaitAndGetTitle(); 315 const string16 result = watcher.WaitAndGetTitle();
290 EXPECT_EQ("PASS", UTF16ToASCII(result)); 316 EXPECT_EQ("PASS", UTF16ToASCII(result));
291 317
292 // Check there is not infobar. 318 // Check there is not infobar.
293 EXPECT_EQ(0U, infobar_service->infobar_count()); 319 EXPECT_EQ(1U, infobar_service->infobar_count());
320 confirm = infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
321 EXPECT_TRUE(confirm);
294 } 322 }
295 323
296 IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, UpdateLocationAtOnload) { 324 IN_PROC_BROWSER_TEST_F(TranslateBrowserTest, UpdateLocationAtOnload) {
297 #if defined(OS_WIN) && defined(USE_ASH) 325 #if defined(OS_WIN) && defined(USE_ASH)
298 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 326 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
299 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 327 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
300 return; 328 return;
301 #endif 329 #endif
302 330
303 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 331 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
304 332
305 content::WebContents* web_contents = 333 content::WebContents* web_contents =
306 browser()->tab_strip_model()->GetActiveWebContents(); 334 browser()->tab_strip_model()->GetActiveWebContents();
307 ASSERT_TRUE(web_contents); 335 ASSERT_TRUE(web_contents);
308 336
309 // Check infobar count. 337 // Check infobar count.
310 InfoBarService* infobar_service = 338 InfoBarService* infobar_service =
311 InfoBarService::FromWebContents(web_contents); 339 InfoBarService::FromWebContents(web_contents);
312 ASSERT_TRUE(infobar_service); 340 ASSERT_TRUE(infobar_service);
313 EXPECT_EQ(0U, infobar_service->infobar_count()); 341 EXPECT_EQ(1U, infobar_service->infobar_count());
342 ConfirmInfoBarDelegate* confirm =
343 infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
344 EXPECT_TRUE(confirm);
hajimehoshi 2013/07/31 07:04:01 ditto
314 345
315 // Setup page title observer. 346 // Setup page title observer.
316 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS")); 347 content::TitleWatcher watcher(web_contents, ASCIIToUTF16("PASS"));
317 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 348 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
318 349
319 // Visit a test page. 350 // Visit a test page.
320 ui_test_utils::NavigateToURL( 351 ui_test_utils::NavigateToURL(
321 browser(), 352 browser(),
322 GetNonSecureURL(kUpdateLocationAtOnloadTestPath)); 353 GetNonSecureURL(kUpdateLocationAtOnloadTestPath));
323 354
324 // Wait for the page title is changed after the test finished. 355 // Wait for the page title is changed after the test finished.
325 const string16 result = watcher.WaitAndGetTitle(); 356 const string16 result = watcher.WaitAndGetTitle();
326 EXPECT_EQ("PASS", UTF16ToASCII(result)); 357 EXPECT_EQ("PASS", UTF16ToASCII(result));
327 358
328 // Check there is not infobar. 359 // Check there is not infobar.
329 EXPECT_EQ(0U, infobar_service->infobar_count()); 360 EXPECT_EQ(1U, infobar_service->infobar_count());
361 confirm = infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
362 EXPECT_TRUE(confirm);
330 } 363 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/ui/startup/bad_flags_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698