| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 9 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
| 10 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h" | 10 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 #if !defined(OS_ANDROID) | 38 #if !defined(OS_ANDROID) |
| 39 class TestManagePasswordsIconView : public ManagePasswordsIconView { | 39 class TestManagePasswordsIconView : public ManagePasswordsIconView { |
| 40 public: | 40 public: |
| 41 TestManagePasswordsIconView() {} | 41 TestManagePasswordsIconView() {} |
| 42 | 42 |
| 43 void SetState(password_manager::ui::State state) override { | 43 void SetState(password_manager::ui::State state) override { |
| 44 state_ = state; | 44 state_ = state; |
| 45 } | 45 } |
| 46 password_manager::ui::State state() { return state_; } | 46 password_manager::ui::State state() { return state_; } |
| 47 void SetActive(bool active) override { | |
| 48 active_ = active; | |
| 49 } | |
| 50 bool active() { return active_; } | |
| 51 | 47 |
| 52 private: | 48 private: |
| 53 password_manager::ui::State state_; | 49 password_manager::ui::State state_; |
| 54 bool active_; | |
| 55 | 50 |
| 56 DISALLOW_COPY_AND_ASSIGN(TestManagePasswordsIconView); | 51 DISALLOW_COPY_AND_ASSIGN(TestManagePasswordsIconView); |
| 57 }; | 52 }; |
| 58 #endif | 53 #endif |
| 59 | 54 |
| 60 // This sublass is used to disable some code paths which are not essential for | 55 // This sublass is used to disable some code paths which are not essential for |
| 61 // testing. | 56 // testing. |
| 62 class TestManagePasswordsUIController : public ManagePasswordsUIController { | 57 class TestManagePasswordsUIController : public ManagePasswordsUIController { |
| 63 public: | 58 public: |
| 64 TestManagePasswordsUIController( | 59 TestManagePasswordsUIController( |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 // Fake-navigate after 5 seconds. We expect the bubble's state to be reset | 576 // Fake-navigate after 5 seconds. We expect the bubble's state to be reset |
| 582 // if a navigation occurs after this limit. | 577 // if a navigation occurs after this limit. |
| 583 controller()->SetElapsed( | 578 controller()->SetElapsed( |
| 584 base::TimeDelta::FromMilliseconds(kSlowNavigationDelayInMS)); | 579 base::TimeDelta::FromMilliseconds(kSlowNavigationDelayInMS)); |
| 585 controller()->DidNavigateMainFrame(content::LoadCommittedDetails(), | 580 controller()->DidNavigateMainFrame(content::LoadCommittedDetails(), |
| 586 content::FrameNavigateParams()); | 581 content::FrameNavigateParams()); |
| 587 EXPECT_EQ(password_manager::ui::INACTIVE_STATE, controller()->state()); | 582 EXPECT_EQ(password_manager::ui::INACTIVE_STATE, controller()->state()); |
| 588 // The following line shouldn't crash browser. | 583 // The following line shouldn't crash browser. |
| 589 controller()->OnNoInteractionOnUpdate(); | 584 controller()->OnNoInteractionOnUpdate(); |
| 590 } | 585 } |
| OLD | NEW |