Chromium Code Reviews| 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/renderer/autofill/password_generation_test_utils.h" | 5 #include "chrome/renderer/autofill/password_generation_test_utils.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "components/autofill/content/common/autofill_messages.h" | 9 #include "components/autofill/content/common/autofill_messages.h" |
| 10 #include "components/autofill/content/renderer/form_autofill_util.h" | 10 #include "components/autofill/content/renderer/form_autofill_util.h" |
| 11 #include "components/autofill/content/renderer/test_password_generation_agent.h" | 11 #include "components/autofill/content/renderer/test_password_generation_agent.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | |
| 13 #include "third_party/WebKit/public/platform/WebString.h" | |
|
please use gerrit instead
2015/06/16 00:53:23
Why this include?
Garrett Casto
2015/06/16 06:15:04
Leftover from an earlier iteration. Removed.
| |
| 12 #include "third_party/WebKit/public/web/WebDocument.h" | 14 #include "third_party/WebKit/public/web/WebDocument.h" |
| 13 #include "third_party/WebKit/public/web/WebFormElement.h" | 15 #include "third_party/WebKit/public/web/WebFormElement.h" |
| 14 | 16 |
| 15 namespace autofill { | 17 namespace autofill { |
| 16 | 18 |
| 17 void SetNotBlacklistedMessage(TestPasswordGenerationAgent* generation_agent, | 19 void SetNotBlacklistedMessage(TestPasswordGenerationAgent* generation_agent, |
| 18 const char* form_str) { | 20 const char* form_str) { |
| 19 autofill::PasswordForm form; | 21 autofill::PasswordForm form; |
| 20 form.origin = | 22 form.origin = |
| 21 GURL(base::StringPrintf("data:text/html;charset=utf-8,%s", form_str)); | 23 GURL(base::StringPrintf("data:text/html;charset=utf-8,%s", form_str)); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 38 EXTRACT_NONE, | 40 EXTRACT_NONE, |
| 39 &form_data, | 41 &form_data, |
| 40 nullptr /* FormFieldData */); | 42 nullptr /* FormFieldData */); |
| 41 | 43 |
| 42 std::vector<autofill::FormData> forms; | 44 std::vector<autofill::FormData> forms; |
| 43 forms.push_back(form_data); | 45 forms.push_back(form_data); |
| 44 AutofillMsg_AccountCreationFormsDetected msg(0, forms); | 46 AutofillMsg_AccountCreationFormsDetected msg(0, forms); |
| 45 generation_agent->OnMessageReceived(msg); | 47 generation_agent->OnMessageReceived(msg); |
| 46 } | 48 } |
| 47 | 49 |
| 50 void ExpectPasswordGenerationAvailable( | |
| 51 TestPasswordGenerationAgent* password_generation, | |
| 52 bool available) { | |
| 53 if (available) { | |
| 54 ASSERT_EQ(1u, password_generation->messages().size()); | |
| 55 EXPECT_EQ(AutofillHostMsg_ShowPasswordGenerationPopup::ID, | |
| 56 password_generation->messages()[0]->type()); | |
| 57 } else { | |
| 58 EXPECT_TRUE(password_generation->messages().empty()); | |
| 59 } | |
| 60 password_generation->clear_messages(); | |
| 61 } | |
| 62 | |
| 48 } // namespace autofill | 63 } // namespace autofill |
| OLD | NEW |