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/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "chrome/browser/ui/passwords/manage_passwords_bubble.h" | 8 #include "chrome/browser/ui/passwords/manage_passwords_bubble.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_icon.h" | 10 #include "chrome/browser/ui/passwords/manage_passwords_icon.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 const int64 kSlowNavigationDelayInMS = 2000; | 27 const int64 kSlowNavigationDelayInMS = 2000; |
28 const int64 kQuickNavigationDelayInMS = 500; | 28 const int64 kQuickNavigationDelayInMS = 500; |
29 | 29 |
30 class MockElapsedTimer : public base::ElapsedTimer { | 30 class MockElapsedTimer : public base::ElapsedTimer { |
31 public: | 31 public: |
32 MockElapsedTimer() {} | 32 MockElapsedTimer() {} |
33 virtual base::TimeDelta Elapsed() const OVERRIDE { return delta_; } | 33 virtual base::TimeDelta Elapsed() const override { return delta_; } |
34 | 34 |
35 void Advance(int64 ms) { delta_ = base::TimeDelta::FromMilliseconds(ms); } | 35 void Advance(int64 ms) { delta_ = base::TimeDelta::FromMilliseconds(ms); } |
36 | 36 |
37 private: | 37 private: |
38 base::TimeDelta delta_; | 38 base::TimeDelta delta_; |
39 | 39 |
40 DISALLOW_COPY_AND_ASSIGN(MockElapsedTimer); | 40 DISALLOW_COPY_AND_ASSIGN(MockElapsedTimer); |
41 }; | 41 }; |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 class ManagePasswordsUIControllerTest : public ChromeRenderViewHostTestHarness { | 45 class ManagePasswordsUIControllerTest : public ChromeRenderViewHostTestHarness { |
46 public: | 46 public: |
47 ManagePasswordsUIControllerTest() {} | 47 ManagePasswordsUIControllerTest() {} |
48 | 48 |
49 virtual void SetUp() OVERRIDE { | 49 virtual void SetUp() override { |
50 ChromeRenderViewHostTestHarness::SetUp(); | 50 ChromeRenderViewHostTestHarness::SetUp(); |
51 | 51 |
52 // Create the test UIController here so that it's bound to | 52 // Create the test UIController here so that it's bound to |
53 // |test_web_contents_|, and will be retrieved correctly via | 53 // |test_web_contents_|, and will be retrieved correctly via |
54 // ManagePasswordsUIController::FromWebContents in |controller()|. | 54 // ManagePasswordsUIController::FromWebContents in |controller()|. |
55 new ManagePasswordsUIControllerMock(web_contents()); | 55 new ManagePasswordsUIControllerMock(web_contents()); |
56 | 56 |
57 test_form_.origin = GURL("http://example.com"); | 57 test_form_.origin = GURL("http://example.com"); |
58 | 58 |
59 // We need to be on a "webby" URL for most tests. | 59 // We need to be on a "webby" URL for most tests. |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 new password_manager::PasswordFormManager( | 317 new password_manager::PasswordFormManager( |
318 NULL, &client, &driver, test_form(), false)); | 318 NULL, &client, &driver, test_form(), false)); |
319 | 319 |
320 controller()->OnAutomaticPasswordSave(test_form_manager.Pass()); | 320 controller()->OnAutomaticPasswordSave(test_form_manager.Pass()); |
321 EXPECT_EQ(password_manager::ui::CONFIRMATION_STATE, controller()->state()); | 321 EXPECT_EQ(password_manager::ui::CONFIRMATION_STATE, controller()->state()); |
322 | 322 |
323 ManagePasswordsIconMock mock; | 323 ManagePasswordsIconMock mock; |
324 controller()->UpdateIconAndBubbleState(&mock); | 324 controller()->UpdateIconAndBubbleState(&mock); |
325 EXPECT_EQ(password_manager::ui::MANAGE_STATE, mock.state()); | 325 EXPECT_EQ(password_manager::ui::MANAGE_STATE, mock.state()); |
326 } | 326 } |
OLD | NEW |