| 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 "chrome/browser/password_manager/password_manager_test_base.h" | 5 #include "chrome/browser/password_manager/password_manager_test_base.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 password_manager::ui::PENDING_PASSWORD_STATE; | 88 password_manager::ui::PENDING_PASSWORD_STATE; |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool BubbleObserver::IsShowingUpdatePrompt() const { | 91 bool BubbleObserver::IsShowingUpdatePrompt() const { |
| 92 return passwords_ui_controller_->GetState() == | 92 return passwords_ui_controller_->GetState() == |
| 93 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE; | 93 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE; |
| 94 } | 94 } |
| 95 | 95 |
| 96 void BubbleObserver::Dismiss() const { | 96 void BubbleObserver::Dismiss() const { |
| 97 passwords_ui_controller_->OnBubbleHidden(); | 97 passwords_ui_controller_->OnBubbleHidden(); |
| 98 // Navigate away to reset the state to inactive. | |
| 99 static_cast<content::WebContentsObserver*>(passwords_ui_controller_) | |
| 100 ->DidNavigateMainFrame(content::LoadCommittedDetails(), | |
| 101 content::FrameNavigateParams()); | |
| 102 ASSERT_EQ(password_manager::ui::INACTIVE_STATE, | 98 ASSERT_EQ(password_manager::ui::INACTIVE_STATE, |
| 103 passwords_ui_controller_->GetState()); | 99 passwords_ui_controller_->GetState()); |
| 104 } | 100 } |
| 105 | 101 |
| 106 void BubbleObserver::AcceptSavePrompt() const { | 102 void BubbleObserver::AcceptSavePrompt() const { |
| 107 ASSERT_TRUE(IsShowingSavePrompt()); | 103 ASSERT_TRUE(IsShowingSavePrompt()); |
| 108 passwords_ui_controller_->SavePassword(); | 104 passwords_ui_controller_->SavePassword(); |
| 109 EXPECT_FALSE(IsShowingSavePrompt()); | 105 EXPECT_FALSE(IsShowingSavePrompt()); |
| 110 } | 106 } |
| 111 | 107 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 " var element = document.getElementById('%s');" | 277 " var element = document.getElementById('%s');" |
| 282 "window.domAutomationController.send(element && element.value == '%s');", | 278 "window.domAutomationController.send(element && element.value == '%s');", |
| 283 iframe_id.c_str(), iframe_id.c_str(), element_id.c_str(), | 279 iframe_id.c_str(), iframe_id.c_str(), element_id.c_str(), |
| 284 element_id.c_str(), expected_value.c_str()); | 280 element_id.c_str(), expected_value.c_str()); |
| 285 bool return_value = false; | 281 bool return_value = false; |
| 286 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 282 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 287 RenderViewHost(), value_check_script, &return_value)); | 283 RenderViewHost(), value_check_script, &return_value)); |
| 288 EXPECT_TRUE(return_value) << "element_id = " << element_id | 284 EXPECT_TRUE(return_value) << "element_id = " << element_id |
| 289 << ", expected_value = " << expected_value; | 285 << ", expected_value = " << expected_value; |
| 290 } | 286 } |
| OLD | NEW |