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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc

Issue 10539066: TabContentsWrapper -> TabContents, part 25. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « no previous file | chrome/browser/safe_browsing/safe_browsing_tab_observer.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This test creates a fake safebrowsing service, where we can inject 5 // This test creates a fake safebrowsing service, where we can inject
6 // malware and phishing urls. It then uses a real browser to go to 6 // malware and phishing urls. It then uses a real browser to go to
7 // these urls, and sends "goback" or "proceed" commands and verifies 7 // these urls, and sends "goback" or "proceed" commands and verifies
8 // they work. 8 // they work.
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/safe_browsing/malware_details.h" 14 #include "chrome/browser/safe_browsing/malware_details.h"
15 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" 15 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
16 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 16 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 18 #include "chrome/browser/ui/tab_contents/tab_contents.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
21 #include "chrome/test/base/in_process_browser_test.h" 21 #include "chrome/test/base/in_process_browser_test.h"
22 #include "chrome/test/base/ui_test_utils.h" 22 #include "chrome/test/base/ui_test_utils.h"
23 #include "content/public/browser/interstitial_page.h" 23 #include "content/public/browser/interstitial_page.h"
24 #include "content/public/browser/navigation_controller.h" 24 #include "content/public/browser/navigation_controller.h"
25 #include "content/public/browser/notification_types.h" 25 #include "content/public/browser/notification_types.h"
26 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
27 #include "content/public/browser/web_contents_view.h" 27 #include "content/public/browser/web_contents_view.h"
28 #include "content/public/test/test_browser_thread.h" 28 #include "content/public/test/test_browser_thread.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 SafeBrowsingService::UrlCheckResult checkresult) { 254 SafeBrowsingService::UrlCheckResult checkresult) {
255 FakeSafeBrowsingService* service = 255 FakeSafeBrowsingService* service =
256 static_cast<FakeSafeBrowsingService*>( 256 static_cast<FakeSafeBrowsingService*>(
257 g_browser_process->safe_browsing_service()); 257 g_browser_process->safe_browsing_service());
258 258
259 ASSERT_TRUE(service); 259 ASSERT_TRUE(service);
260 service->AddURLResult(url, checkresult); 260 service->AddURLResult(url, checkresult);
261 } 261 }
262 262
263 void SendCommand(const std::string& command) { 263 void SendCommand(const std::string& command) {
264 WebContents* contents = 264 WebContents* contents = browser()->GetActiveWebContents();
265 browser()->GetSelectedTabContentsWrapper()->web_contents();
266 // We use InterstitialPage::GetInterstitialPage(tab) instead of 265 // We use InterstitialPage::GetInterstitialPage(tab) instead of
267 // tab->GetInterstitialPage() because the tab doesn't have a pointer 266 // tab->GetInterstitialPage() because the tab doesn't have a pointer
268 // to its interstital page until it gets a command from the renderer 267 // to its interstital page until it gets a command from the renderer
269 // that it has indeed displayed it -- and this sometimes happens after 268 // that it has indeed displayed it -- and this sometimes happens after
270 // NavigateToURL returns. 269 // NavigateToURL returns.
271 SafeBrowsingBlockingPage* interstitial_page = 270 SafeBrowsingBlockingPage* interstitial_page =
272 static_cast<SafeBrowsingBlockingPage*>( 271 static_cast<SafeBrowsingBlockingPage*>(
273 InterstitialPage::GetInterstitialPage(contents)-> 272 InterstitialPage::GetInterstitialPage(contents)->
274 GetDelegateForTesting()); 273 GetDelegateForTesting());
275 ASSERT_TRUE(interstitial_page); 274 ASSERT_TRUE(interstitial_page);
276 interstitial_page->CommandReceived(command); 275 interstitial_page->CommandReceived(command);
277 } 276 }
278 277
279 void DontProceedThroughInterstitial() { 278 void DontProceedThroughInterstitial() {
280 WebContents* contents = 279 WebContents* contents = browser()->GetActiveWebContents();
281 browser()->GetSelectedTabContentsWrapper()->web_contents();
282 InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage( 280 InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage(
283 contents); 281 contents);
284 ASSERT_TRUE(interstitial_page); 282 ASSERT_TRUE(interstitial_page);
285 interstitial_page->DontProceed(); 283 interstitial_page->DontProceed();
286 } 284 }
287 285
288 void ProceedThroughInterstitial() { 286 void ProceedThroughInterstitial() {
289 WebContents* contents = 287 WebContents* contents = browser()->GetActiveWebContents();
290 browser()->GetSelectedTabContentsWrapper()->web_contents();
291 InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage( 288 InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage(
292 contents); 289 contents);
293 ASSERT_TRUE(interstitial_page); 290 ASSERT_TRUE(interstitial_page);
294 interstitial_page->Proceed(); 291 interstitial_page->Proceed();
295 } 292 }
296 293
297 void AssertNoInterstitial(bool wait_for_delete) { 294 void AssertNoInterstitial(bool wait_for_delete) {
298 WebContents* contents = 295 WebContents* contents = browser()->GetActiveWebContents();
299 browser()->GetSelectedTabContentsWrapper()->web_contents();
300 296
301 if (contents->ShowingInterstitialPage() && wait_for_delete) { 297 if (contents->ShowingInterstitialPage() && wait_for_delete) {
302 // We'll get notified when the interstitial is deleted. 298 // We'll get notified when the interstitial is deleted.
303 TestSafeBrowsingBlockingPage* page = 299 TestSafeBrowsingBlockingPage* page =
304 static_cast<TestSafeBrowsingBlockingPage*>( 300 static_cast<TestSafeBrowsingBlockingPage*>(
305 contents->GetInterstitialPage()->GetDelegateForTesting()); 301 contents->GetInterstitialPage()->GetDelegateForTesting());
306 page->WaitForDelete(); 302 page->WaitForDelete();
307 } 303 }
308 304
309 // Can't use InterstitialPage::GetInterstitialPage() because that 305 // Can't use InterstitialPage::GetInterstitialPage() because that
310 // gets updated after the TestSafeBrowsingBlockingPage destructor 306 // gets updated after the TestSafeBrowsingBlockingPage destructor
311 ASSERT_FALSE(contents->ShowingInterstitialPage()); 307 ASSERT_FALSE(contents->ShowingInterstitialPage());
312 } 308 }
313 309
314 bool YesInterstitial() { 310 bool YesInterstitial() {
315 WebContents* contents = 311 WebContents* contents = browser()->GetActiveWebContents();
316 browser()->GetSelectedTabContentsWrapper()->web_contents();
317 InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage( 312 InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage(
318 contents); 313 contents);
319 return interstitial_page != NULL; 314 return interstitial_page != NULL;
320 } 315 }
321 316
322 void WaitForInterstitial() { 317 void WaitForInterstitial() {
323 WebContents* contents = 318 WebContents* contents = browser()->GetActiveWebContents();
324 browser()->GetSelectedTabContentsWrapper()->web_contents();
325 ui_test_utils::WindowedNotificationObserver interstitial_observer( 319 ui_test_utils::WindowedNotificationObserver interstitial_observer(
326 content::NOTIFICATION_INTERSTITIAL_ATTACHED, 320 content::NOTIFICATION_INTERSTITIAL_ATTACHED,
327 content::Source<WebContents>(contents)); 321 content::Source<WebContents>(contents));
328 if (!InterstitialPage::GetInterstitialPage(contents)) 322 if (!InterstitialPage::GetInterstitialPage(contents))
329 interstitial_observer.Wait(); 323 interstitial_observer.Wait();
330 } 324 }
331 325
332 void AssertReportSent() { 326 void AssertReportSent() {
333 // When a report is scheduled in the IO thread we should get notified. 327 // When a report is scheduled in the IO thread we should get notified.
334 ui_test_utils::RunMessageLoop(); 328 ui_test_utils::RunMessageLoop();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareDontProceed) { 402 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareDontProceed) {
409 GURL url = test_server()->GetURL(kEmptyPage); 403 GURL url = test_server()->GetURL(kEmptyPage);
410 AddURLResult(url, SafeBrowsingService::URL_MALWARE); 404 AddURLResult(url, SafeBrowsingService::URL_MALWARE);
411 405
412 ui_test_utils::NavigateToURL(browser(), url); 406 ui_test_utils::NavigateToURL(browser(), url);
413 407
414 SendCommand("\"takeMeBack\""); // Simulate the user clicking "back" 408 SendCommand("\"takeMeBack\""); // Simulate the user clicking "back"
415 AssertNoInterstitial(false); // Assert the interstitial is gone 409 AssertNoInterstitial(false); // Assert the interstitial is gone
416 EXPECT_EQ( 410 EXPECT_EQ(
417 GURL(chrome::kAboutBlankURL), // Back to "about:blank" 411 GURL(chrome::kAboutBlankURL), // Back to "about:blank"
418 browser()->GetSelectedTabContentsWrapper()->web_contents()->GetURL()); 412 browser()->GetActiveWebContents()->GetURL());
419 } 413 }
420 414
421 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareProceed) { 415 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareProceed) {
422 GURL url = test_server()->GetURL(kEmptyPage); 416 GURL url = test_server()->GetURL(kEmptyPage);
423 AddURLResult(url, SafeBrowsingService::URL_MALWARE); 417 AddURLResult(url, SafeBrowsingService::URL_MALWARE);
424 418
425 // Note: NOTIFICATION_LOAD_STOP may come before or after the DidNavigate 419 // Note: NOTIFICATION_LOAD_STOP may come before or after the DidNavigate
426 // event that clears the interstitial. We wait for DidNavigate instead. 420 // event that clears the interstitial. We wait for DidNavigate instead.
427 ui_test_utils::NavigateToURL(browser(), url); 421 ui_test_utils::NavigateToURL(browser(), url);
428 ui_test_utils::WindowedNotificationObserver observer( 422 ui_test_utils::WindowedNotificationObserver observer(
429 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 423 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
430 content::Source<NavigationController>( 424 content::Source<NavigationController>(
431 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> 425 &browser()->GetActiveWebContents()->GetController()));
432 GetController()));
433 SendCommand("\"proceed\""); // Simulate the user clicking "proceed" 426 SendCommand("\"proceed\""); // Simulate the user clicking "proceed"
434 observer.Wait(); 427 observer.Wait();
435 AssertNoInterstitial(true); // Assert the interstitial is gone. 428 AssertNoInterstitial(true); // Assert the interstitial is gone.
436 EXPECT_EQ( 429 EXPECT_EQ(url, browser()->GetActiveWebContents()->GetURL());
437 url,
438 browser()->GetSelectedTabContentsWrapper()->web_contents()->GetURL());
439 } 430 }
440 431
441 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingDontProceed) { 432 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingDontProceed) {
442 GURL url = test_server()->GetURL(kEmptyPage); 433 GURL url = test_server()->GetURL(kEmptyPage);
443 AddURLResult(url, SafeBrowsingService::URL_PHISHING); 434 AddURLResult(url, SafeBrowsingService::URL_PHISHING);
444 435
445 ui_test_utils::NavigateToURL(browser(), url); 436 ui_test_utils::NavigateToURL(browser(), url);
446 437
447 SendCommand("\"takeMeBack\""); // Simulate the user clicking "proceed" 438 SendCommand("\"takeMeBack\""); // Simulate the user clicking "proceed"
448 AssertNoInterstitial(false); // Assert the interstitial is gone 439 AssertNoInterstitial(false); // Assert the interstitial is gone
449 EXPECT_EQ( 440 EXPECT_EQ(
450 GURL(chrome::kAboutBlankURL), // We are back to "about:blank". 441 GURL(chrome::kAboutBlankURL), // We are back to "about:blank".
451 browser()->GetSelectedTabContentsWrapper()->web_contents()->GetURL()); 442 browser()->GetActiveWebContents()->GetURL());
452 } 443 }
453 444
454 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingProceed) { 445 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingProceed) {
455 GURL url = test_server()->GetURL(kEmptyPage); 446 GURL url = test_server()->GetURL(kEmptyPage);
456 AddURLResult(url, SafeBrowsingService::URL_PHISHING); 447 AddURLResult(url, SafeBrowsingService::URL_PHISHING);
457 448
458 ui_test_utils::NavigateToURL(browser(), url); 449 ui_test_utils::NavigateToURL(browser(), url);
459 450
460 // Note: NOTIFICATION_LOAD_STOP may come before or after the DidNavigate 451 // Note: NOTIFICATION_LOAD_STOP may come before or after the DidNavigate
461 // event that clears the interstitial. We wait for DidNavigate instead. 452 // event that clears the interstitial. We wait for DidNavigate instead.
462 ui_test_utils::WindowedNotificationObserver observer( 453 ui_test_utils::WindowedNotificationObserver observer(
463 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 454 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
464 content::Source<NavigationController>( 455 content::Source<NavigationController>(
465 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> 456 &browser()->GetActiveWebContents()->GetController()));
466 GetController()));
467 SendCommand("\"proceed\""); // Simulate the user clicking "proceed". 457 SendCommand("\"proceed\""); // Simulate the user clicking "proceed".
468 observer.Wait(); 458 observer.Wait();
469 AssertNoInterstitial(true); // Assert the interstitial is gone 459 AssertNoInterstitial(true); // Assert the interstitial is gone
470 EXPECT_EQ( 460 EXPECT_EQ(url, browser()->GetActiveWebContents()->GetURL());
471 url,
472 browser()->GetSelectedTabContentsWrapper()->web_contents()->GetURL());
473 } 461 }
474 462
475 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingReportError) { 463 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingReportError) {
476 GURL url = test_server()->GetURL(kEmptyPage); 464 GURL url = test_server()->GetURL(kEmptyPage);
477 AddURLResult(url, SafeBrowsingService::URL_PHISHING); 465 AddURLResult(url, SafeBrowsingService::URL_PHISHING);
478 466
479 ui_test_utils::NavigateToURL(browser(), url); 467 ui_test_utils::NavigateToURL(browser(), url);
480 468
481 // Note: NOTIFICATION_LOAD_STOP may come before or after the DidNavigate 469 // Note: NOTIFICATION_LOAD_STOP may come before or after the DidNavigate
482 // event that clears the interstitial. We wait for DidNavigate instead. 470 // event that clears the interstitial. We wait for DidNavigate instead.
483 ui_test_utils::WindowedNotificationObserver observer( 471 ui_test_utils::WindowedNotificationObserver observer(
484 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 472 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
485 content::Source<NavigationController>( 473 content::Source<NavigationController>(
486 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> 474 &browser()->GetActiveWebContents()->GetController()));
487 GetController()));
488 SendCommand("\"reportError\""); // Simulate the user clicking "report error" 475 SendCommand("\"reportError\""); // Simulate the user clicking "report error"
489 observer.Wait(); 476 observer.Wait();
490 AssertNoInterstitial(false); // Assert the interstitial is gone 477 AssertNoInterstitial(false); // Assert the interstitial is gone
491 478
492 // We are in the error reporting page. 479 // We are in the error reporting page.
493 EXPECT_EQ( 480 EXPECT_EQ(
494 "/safebrowsing/report_error/", 481 "/safebrowsing/report_error/",
495 browser()->GetSelectedTabContentsWrapper()->web_contents()->GetURL(). 482 browser()->GetActiveWebContents()->GetURL().path());
496 path());
497 } 483 }
498 484
499 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, 485 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
500 PhishingLearnMore) { 486 PhishingLearnMore) {
501 GURL url = test_server()->GetURL(kEmptyPage); 487 GURL url = test_server()->GetURL(kEmptyPage);
502 AddURLResult(url, SafeBrowsingService::URL_PHISHING); 488 AddURLResult(url, SafeBrowsingService::URL_PHISHING);
503 489
504 ui_test_utils::NavigateToURL(browser(), url); 490 ui_test_utils::NavigateToURL(browser(), url);
505 491
506 // Note: NOTIFICATION_LOAD_STOP may come before or after the DidNavigate 492 // Note: NOTIFICATION_LOAD_STOP may come before or after the DidNavigate
507 // event that clears the interstitial. We wait for DidNavigate instead. 493 // event that clears the interstitial. We wait for DidNavigate instead.
508 ui_test_utils::WindowedNotificationObserver observer( 494 ui_test_utils::WindowedNotificationObserver observer(
509 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 495 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
510 content::Source<NavigationController>( 496 content::Source<NavigationController>(
511 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> 497 &browser()->GetActiveWebContents()->GetController()));
512 GetController()));
513 SendCommand("\"learnMore\""); // Simulate the user clicking "learn more" 498 SendCommand("\"learnMore\""); // Simulate the user clicking "learn more"
514 observer.Wait(); 499 observer.Wait();
515 AssertNoInterstitial(false); // Assert the interstitial is gone 500 AssertNoInterstitial(false); // Assert the interstitial is gone
516 501
517 // We are in the help page. 502 // We are in the help page.
518 EXPECT_EQ( 503 EXPECT_EQ(
519 "/support/bin/answer.py", 504 "/support/bin/answer.py",
520 browser()->GetSelectedTabContentsWrapper()->web_contents()->GetURL(). 505 browser()->GetActiveWebContents()->GetURL().path());
521 path());
522 } 506 }
523 507
524 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareIframeDontProceed) { 508 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareIframeDontProceed) {
525 GURL url = test_server()->GetURL(kMalwarePage); 509 GURL url = test_server()->GetURL(kMalwarePage);
526 GURL iframe_url = test_server()->GetURL(kMalwareIframe); 510 GURL iframe_url = test_server()->GetURL(kMalwareIframe);
527 AddURLResult(iframe_url, SafeBrowsingService::URL_MALWARE); 511 AddURLResult(iframe_url, SafeBrowsingService::URL_MALWARE);
528 512
529 ui_test_utils::NavigateToURL(browser(), url); 513 ui_test_utils::NavigateToURL(browser(), url);
530 514
531 ui_test_utils::WindowedNotificationObserver observer( 515 ui_test_utils::WindowedNotificationObserver observer(
532 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 516 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
533 content::Source<NavigationController>( 517 content::Source<NavigationController>(
534 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> 518 &browser()->GetActiveWebContents()->GetController()));
535 GetController()));
536 SendCommand("\"takeMeBack\""); // Simulate the user clicking "back" 519 SendCommand("\"takeMeBack\""); // Simulate the user clicking "back"
537 observer.Wait(); 520 observer.Wait();
538 AssertNoInterstitial(false); // Assert the interstitial is gone 521 AssertNoInterstitial(false); // Assert the interstitial is gone
539 522
540 EXPECT_EQ( 523 EXPECT_EQ(
541 GURL(chrome::kAboutBlankURL), // Back to "about:blank" 524 GURL(chrome::kAboutBlankURL), // Back to "about:blank"
542 browser()->GetSelectedTabContentsWrapper()->web_contents()->GetURL()); 525 browser()->GetActiveWebContents()->GetURL());
543 } 526 }
544 527
545 // Crashy, http://crbug.com/68834. 528 // Crashy, http://crbug.com/68834.
546 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, 529 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
547 DISABLED_MalwareIframeProceed) { 530 DISABLED_MalwareIframeProceed) {
548 GURL url = test_server()->GetURL(kMalwarePage); 531 GURL url = test_server()->GetURL(kMalwarePage);
549 GURL iframe_url = test_server()->GetURL(kMalwareIframe); 532 GURL iframe_url = test_server()->GetURL(kMalwareIframe);
550 AddURLResult(iframe_url, SafeBrowsingService::URL_MALWARE); 533 AddURLResult(iframe_url, SafeBrowsingService::URL_MALWARE);
551 534
552 ui_test_utils::NavigateToURL(browser(), url); 535 ui_test_utils::NavigateToURL(browser(), url);
553 536
554 SendCommand("\"proceed\""); // Simulate the user clicking "proceed" 537 SendCommand("\"proceed\""); // Simulate the user clicking "proceed"
555 AssertNoInterstitial(true); // Assert the interstitial is gone 538 AssertNoInterstitial(true); // Assert the interstitial is gone
556 539
557 EXPECT_EQ( 540 EXPECT_EQ(url, browser()->GetActiveWebContents()->GetURL());
558 url,
559 browser()->GetSelectedTabContentsWrapper()->web_contents()->GetURL());
560 } 541 }
561 542
562 // Crashy, http://crbug.com/99159. 543 // Crashy, http://crbug.com/99159.
563 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, 544 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
564 DISABLED_MalwareIframeReportDetails) { 545 DISABLED_MalwareIframeReportDetails) {
565 GURL url = test_server()->GetURL(kMalwarePage); 546 GURL url = test_server()->GetURL(kMalwarePage);
566 GURL iframe_url = test_server()->GetURL(kMalwareIframe); 547 GURL iframe_url = test_server()->GetURL(kMalwareIframe);
567 AddURLResult(iframe_url, SafeBrowsingService::URL_MALWARE); 548 AddURLResult(iframe_url, SafeBrowsingService::URL_MALWARE);
568 549
569 ui_test_utils::NavigateToURL(browser(), url); 550 ui_test_utils::NavigateToURL(browser(), url);
570 551
571 // If the DOM details from renderer did not already return, wait for them. 552 // If the DOM details from renderer did not already return, wait for them.
572 details_factory_.get_details()->WaitForDOM(); 553 details_factory_.get_details()->WaitForDOM();
573 554
574 SendCommand("\"doReport\""); // Simulate the user checking the checkbox. 555 SendCommand("\"doReport\""); // Simulate the user checking the checkbox.
575 EXPECT_TRUE(browser()->profile()->GetPrefs()->GetBoolean( 556 EXPECT_TRUE(browser()->profile()->GetPrefs()->GetBoolean(
576 prefs::kSafeBrowsingReportingEnabled)); 557 prefs::kSafeBrowsingReportingEnabled));
577 558
578 SendCommand("\"proceed\""); // Simulate the user clicking "back" 559 SendCommand("\"proceed\""); // Simulate the user clicking "back"
579 AssertNoInterstitial(true); // Assert the interstitial is gone 560 AssertNoInterstitial(true); // Assert the interstitial is gone
580 561
581 EXPECT_EQ( 562 EXPECT_EQ(url, browser()->GetActiveWebContents()->GetURL());
582 url,
583 browser()->GetSelectedTabContentsWrapper()->web_contents()->GetURL());
584 AssertReportSent(); 563 AssertReportSent();
585 } 564 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_tab_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698