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

Side by Side Diff: chrome/browser/password_manager/password_manager_browsertest.cc

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 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 <string> 5 #include <string>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 scoped_refptr<password_manager::TestPasswordStore> password_store = 1283 scoped_refptr<password_manager::TestPasswordStore> password_store =
1284 static_cast<password_manager::TestPasswordStore*>( 1284 static_cast<password_manager::TestPasswordStore*>(
1285 PasswordStoreFactory::GetForProfile( 1285 PasswordStoreFactory::GetForProfile(
1286 browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get()); 1286 browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get());
1287 EXPECT_TRUE(password_store->IsEmpty()); 1287 EXPECT_TRUE(password_store->IsEmpty());
1288 1288
1289 // Navigate to a page requiring HTTP auth. Wait for the tab to get the correct 1289 // Navigate to a page requiring HTTP auth. Wait for the tab to get the correct
1290 // WebContents, but don't wait for navigation, which only finishes after 1290 // WebContents, but don't wait for navigation, which only finishes after
1291 // authentication. 1291 // authentication.
1292 ui_test_utils::NavigateToURLWithDisposition( 1292 ui_test_utils::NavigateToURLWithDisposition(
1293 browser(), 1293 browser(), embedded_test_server()->GetURL("/basic_auth"),
1294 embedded_test_server()->GetURL("/basic_auth"), 1294 WindowOpenDisposition::NEW_FOREGROUND_TAB,
1295 NEW_FOREGROUND_TAB,
1296 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); 1295 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
1297 1296
1298 content::NavigationController* nav_controller = 1297 content::NavigationController* nav_controller =
1299 &WebContents()->GetController(); 1298 &WebContents()->GetController();
1300 NavigationObserver nav_observer(WebContents()); 1299 NavigationObserver nav_observer(WebContents());
1301 std::unique_ptr<BubbleObserver> prompt_observer( 1300 std::unique_ptr<BubbleObserver> prompt_observer(
1302 new BubbleObserver(WebContents())); 1301 new BubbleObserver(WebContents()));
1303 WindowedAuthNeededObserver auth_needed_observer(nav_controller); 1302 WindowedAuthNeededObserver auth_needed_observer(nav_controller);
1304 auth_needed_observer.Wait(); 1303 auth_needed_observer.Wait();
1305 1304
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
2579 // The mock observer should not receive the stored credentials. 2578 // The mock observer should not receive the stored credentials.
2580 EXPECT_CALL(mock_login_model_observer, OnAutofillDataAvailableInternal(_, _)) 2579 EXPECT_CALL(mock_login_model_observer, OnAutofillDataAvailableInternal(_, _))
2581 .Times(0); 2580 .Times(0);
2582 2581
2583 // Now wait until the navigation to the test server causes a HTTP auth dialog 2582 // Now wait until the navigation to the test server causes a HTTP auth dialog
2584 // to appear. 2583 // to appear.
2585 content::NavigationController* nav_controller = 2584 content::NavigationController* nav_controller =
2586 &WebContents()->GetController(); 2585 &WebContents()->GetController();
2587 WindowedAuthNeededObserver auth_needed_observer(nav_controller); 2586 WindowedAuthNeededObserver auth_needed_observer(nav_controller);
2588 ui_test_utils::NavigateToURLWithDisposition( 2587 ui_test_utils::NavigateToURLWithDisposition(
2589 browser(), embedded_test_server()->GetURL("/basic_auth"), CURRENT_TAB, 2588 browser(), embedded_test_server()->GetURL("/basic_auth"),
2590 ui_test_utils::BROWSER_TEST_NONE); 2589 WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE);
2591 auth_needed_observer.Wait(); 2590 auth_needed_observer.Wait();
2592 2591
2593 // The auth dialog caused a query to PasswordStore, make sure it was 2592 // The auth dialog caused a query to PasswordStore, make sure it was
2594 // processed. 2593 // processed.
2595 base::RunLoop run_loop2; 2594 base::RunLoop run_loop2;
2596 run_loop2.RunUntilIdle(); 2595 run_loop2.RunUntilIdle();
2597 2596
2598 password_manager->RemoveObserver(&mock_login_model_observer); 2597 password_manager->RemoveObserver(&mock_login_model_observer);
2599 } 2598 }
2600 2599
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2739 std::string actual_password; 2738 std::string actual_password;
2740 ASSERT_TRUE(content::ExecuteScriptAndExtractString( 2739 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
2741 RenderViewHost(), get_password, &actual_password)); 2740 RenderViewHost(), get_password, &actual_password));
2742 EXPECT_EQ("mypassword", actual_password); 2741 EXPECT_EQ("mypassword", actual_password);
2743 } 2742 }
2744 2743
2745 // Check that the internals page contains logs both from the renderer and the 2744 // Check that the internals page contains logs both from the renderer and the
2746 // browser. 2745 // browser.
2747 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, InternalsPage) { 2746 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, InternalsPage) {
2748 ui_test_utils::NavigateToURLWithDisposition( 2747 ui_test_utils::NavigateToURLWithDisposition(
2749 browser(), GURL("chrome://password-manager-internals"), CURRENT_TAB, 2748 browser(), GURL("chrome://password-manager-internals"),
2749 WindowOpenDisposition::CURRENT_TAB,
2750 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 2750 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
2751 content::WebContents* internals_web_contents = WebContents(); 2751 content::WebContents* internals_web_contents = WebContents();
2752 2752
2753 ui_test_utils::NavigateToURLWithDisposition( 2753 ui_test_utils::NavigateToURLWithDisposition(
2754 browser(), embedded_test_server()->GetURL("/password/password_form.html"), 2754 browser(), embedded_test_server()->GetURL("/password/password_form.html"),
2755 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 2755 WindowOpenDisposition::NEW_FOREGROUND_TAB,
2756 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
2756 2757
2757 std::string find_renderer_logs = 2758 std::string find_renderer_logs =
2758 "var text = document.getElementById('log-entries').innerText;" 2759 "var text = document.getElementById('log-entries').innerText;"
2759 "var logs_found = /PasswordAutofillAgent::/.test(text);" 2760 "var logs_found = /PasswordAutofillAgent::/.test(text);"
2760 "window.domAutomationController.send(logs_found);"; 2761 "window.domAutomationController.send(logs_found);";
2761 bool renderer_logs_found; 2762 bool renderer_logs_found;
2762 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 2763 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
2763 internals_web_contents->GetRenderViewHost(), find_renderer_logs, 2764 internals_web_contents->GetRenderViewHost(), find_renderer_logs,
2764 &renderer_logs_found)); 2765 &renderer_logs_found));
2765 EXPECT_TRUE(renderer_logs_found); 2766 EXPECT_TRUE(renderer_logs_found);
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
3046 // about all frames, not just the main one. The factories should receive 3047 // about all frames, not just the main one. The factories should receive
3047 // messages for non-main frames, in particular 3048 // messages for non-main frames, in particular
3048 // AutofillHostMsg_PasswordFormsParsed. If that were the first time the 3049 // AutofillHostMsg_PasswordFormsParsed. If that were the first time the
3049 // factories hear about such frames, this would crash. 3050 // factories hear about such frames, this would crash.
3050 tab_strip_model->AddWebContents(detached_web_contents.release(), -1, 3051 tab_strip_model->AddWebContents(detached_web_contents.release(), -1,
3051 ::ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 3052 ::ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
3052 TabStripModel::ADD_ACTIVE); 3053 TabStripModel::ADD_ACTIVE);
3053 } 3054 }
3054 3055
3055 } // namespace password_manager 3056 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698