| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/run_loop.h" | 5 #include "base/run_loop.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/password_manager/password_manager_test_base.h" | 7 #include "chrome/browser/password_manager/password_manager_test_base.h" |
| 8 #include "chrome/browser/password_manager/password_store_factory.h" | 8 #include "chrome/browser/password_manager/password_store_factory.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "components/password_manager/core/browser/test_password_store.h" | 10 #include "components/password_manager/core/browser/test_password_store.h" |
| 11 #include "content/public/test/browser_test_utils.h" | 11 #include "content/public/test/browser_test_utils.h" |
| 12 #include "content/public/test/test_utils.h" | 12 #include "content/public/test/test_utils.h" |
| 13 #include "ui/events/keycodes/keyboard_codes.h" | 13 #include "ui/events/keycodes/keyboard_codes.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 void SimulateUserTypingInField(content::RenderViewHost* render_view_host, | 17 void SimulateUserTypingInField(content::RenderViewHost* render_view_host, |
| 18 content::WebContents* web_contents, | 18 content::WebContents* web_contents, |
| 19 const std::string& field_id) { | 19 const std::string& field_id) { |
| 20 std::string focus("document.getElementById('" + field_id + "').focus();"); | 20 std::string focus("document.getElementById('" + field_id + "').focus();"); |
| 21 ASSERT_TRUE(content::ExecuteScript(render_view_host, focus)); | 21 ASSERT_TRUE(content::ExecuteScript(render_view_host, focus)); |
| 22 | 22 |
| 23 content::SimulateKeyPress(web_contents, ui::VKEY_O, false, false, false, | 23 content::SimulateKeyPress(web_contents, ui::DomKey::FromCharacter('O'), |
| 24 ui::DomCode::US_O, ui::VKEY_O, false, false, false, |
| 24 false); | 25 false); |
| 25 content::SimulateKeyPress(web_contents, ui::VKEY_R, false, false, false, | 26 content::SimulateKeyPress(web_contents, ui::DomKey::FromCharacter('R'), |
| 27 ui::DomCode::US_R, ui::VKEY_R, false, false, false, |
| 26 false); | 28 false); |
| 27 content::SimulateKeyPress(web_contents, ui::VKEY_A, false, false, false, | 29 content::SimulateKeyPress(web_contents, ui::DomKey::FromCharacter('A'), |
| 30 ui::DomCode::US_A, ui::VKEY_A, false, false, false, |
| 28 false); | 31 false); |
| 29 content::SimulateKeyPress(web_contents, ui::VKEY_R, false, false, false, | 32 content::SimulateKeyPress(web_contents, ui::DomKey::FromCharacter('R'), |
| 33 ui::DomCode::US_R, ui::VKEY_R, false, false, false, |
| 30 false); | 34 false); |
| 31 content::SimulateKeyPress(web_contents, ui::VKEY_Y, false, false, false, | 35 content::SimulateKeyPress(web_contents, ui::DomKey::FromCharacter('Y'), |
| 36 ui::DomCode::US_Y, ui::VKEY_Y, false, false, false, |
| 32 false); | 37 false); |
| 33 } | 38 } |
| 34 | 39 |
| 35 } // namespace | 40 } // namespace |
| 36 | 41 |
| 37 namespace password_manager { | 42 namespace password_manager { |
| 38 | 43 |
| 39 // TODO(crbug.com/616627): Flaky on Mac, CrOS and Linux. | 44 // TODO(crbug.com/616627): Flaky on Mac, CrOS and Linux. |
| 40 #if defined(OS_MACOSX) || defined(OS_CHROMEOS) || defined(OS_LINUX) | 45 #if defined(OS_MACOSX) || defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 41 #define MAYBE_UsernameChanged DISABLED_UsernameChanged | 46 #define MAYBE_UsernameChanged DISABLED_UsernameChanged |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 password_store->stored_passwords(); | 116 password_store->stored_passwords(); |
| 112 EXPECT_EQ(1u, stored_passwords.size()); | 117 EXPECT_EQ(1u, stored_passwords.size()); |
| 113 EXPECT_EQ(2u, stored_passwords.begin()->second.size()); | 118 EXPECT_EQ(2u, stored_passwords.begin()->second.size()); |
| 114 EXPECT_EQ(base::UTF8ToUTF16("temp"), | 119 EXPECT_EQ(base::UTF8ToUTF16("temp"), |
| 115 (stored_passwords.begin()->second)[0].username_value); | 120 (stored_passwords.begin()->second)[0].username_value); |
| 116 EXPECT_EQ(base::UTF8ToUTF16("tempORARY"), | 121 EXPECT_EQ(base::UTF8ToUTF16("tempORARY"), |
| 117 (stored_passwords.begin()->second)[1].username_value); | 122 (stored_passwords.begin()->second)[1].username_value); |
| 118 } | 123 } |
| 119 | 124 |
| 120 } // namespace password_manager | 125 } // namespace password_manager |
| OLD | NEW |