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 "components/password_manager/content/browser/content_password_manager_d
river.h" | 5 #include "components/password_manager/content/browser/content_password_manager_d
river.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 9 #include "base/macros.h" |
7 #include "components/autofill/content/common/autofill_messages.h" | 10 #include "components/autofill/content/common/autofill_messages.h" |
8 #include "components/autofill/core/browser/test_autofill_client.h" | 11 #include "components/autofill/core/browser/test_autofill_client.h" |
9 #include "components/password_manager/core/browser/stub_log_manager.h" | 12 #include "components/password_manager/core/browser/stub_log_manager.h" |
10 #include "components/password_manager/core/browser/stub_password_manager_client.
h" | 13 #include "components/password_manager/core/browser/stub_password_manager_client.
h" |
11 #include "content/public/test/mock_render_process_host.h" | 14 #include "content/public/test/mock_render_process_host.h" |
12 #include "content/public/test/test_renderer_host.h" | 15 #include "content/public/test/test_renderer_host.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
15 | 18 |
16 using testing::Return; | 19 using testing::Return; |
(...skipping 24 matching lines...) Expand all Loading... |
41 : public content::RenderViewHostTestHarness, | 44 : public content::RenderViewHostTestHarness, |
42 public testing::WithParamInterface<bool> { | 45 public testing::WithParamInterface<bool> { |
43 public: | 46 public: |
44 void SetUp() override { | 47 void SetUp() override { |
45 content::RenderViewHostTestHarness::SetUp(); | 48 content::RenderViewHostTestHarness::SetUp(); |
46 ON_CALL(password_manager_client_, GetLogManager()) | 49 ON_CALL(password_manager_client_, GetLogManager()) |
47 .WillByDefault(Return(&log_manager_)); | 50 .WillByDefault(Return(&log_manager_)); |
48 } | 51 } |
49 | 52 |
50 bool WasLoggingActivationMessageSent(bool* activation_flag) { | 53 bool WasLoggingActivationMessageSent(bool* activation_flag) { |
51 const uint32 kMsgID = AutofillMsg_SetLoggingState::ID; | 54 const uint32_t kMsgID = AutofillMsg_SetLoggingState::ID; |
52 const IPC::Message* message = | 55 const IPC::Message* message = |
53 process()->sink().GetFirstMessageMatching(kMsgID); | 56 process()->sink().GetFirstMessageMatching(kMsgID); |
54 if (!message) | 57 if (!message) |
55 return false; | 58 return false; |
56 base::Tuple<bool> param; | 59 base::Tuple<bool> param; |
57 AutofillMsg_SetLoggingState::Read(message, ¶m); | 60 AutofillMsg_SetLoggingState::Read(message, ¶m); |
58 *activation_flag = base::get<0>(param); | 61 *activation_flag = base::get<0>(param); |
59 process()->sink().ClearMessages(); | 62 process()->sink().ClearMessages(); |
60 return true; | 63 return true; |
61 } | 64 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 bool logging_activated = false; | 109 bool logging_activated = false; |
107 EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_activated)); | 110 EXPECT_TRUE(WasLoggingActivationMessageSent(&logging_activated)); |
108 EXPECT_EQ(should_allow_logging, logging_activated); | 111 EXPECT_EQ(should_allow_logging, logging_activated); |
109 } | 112 } |
110 | 113 |
111 INSTANTIATE_TEST_CASE_P(, | 114 INSTANTIATE_TEST_CASE_P(, |
112 ContentPasswordManagerDriverTest, | 115 ContentPasswordManagerDriverTest, |
113 testing::Values(true, false)); | 116 testing::Values(true, false)); |
114 | 117 |
115 } // namespace password_manager | 118 } // namespace password_manager |
OLD | NEW |