Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: chrome/browser/autofill/autofill_manager_unittest.cc

Issue 10837363: Introduce AutofillClient and use it to get rid of PasswordManager dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix header Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "base/tuple.h" 15 #include "base/tuple.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/api/prefs/pref_service_base.h" 17 #include "chrome/browser/api/prefs/pref_service_base.h"
18 #include "chrome/browser/autofill/autocomplete_history_manager.h" 18 #include "chrome/browser/autofill/autocomplete_history_manager.h"
19 #include "chrome/browser/autofill/autofill_common_test.h" 19 #include "chrome/browser/autofill/autofill_common_test.h"
20 #include "chrome/browser/autofill/autofill_manager.h" 20 #include "chrome/browser/autofill/autofill_manager.h"
21 #include "chrome/browser/autofill/autofill_profile.h" 21 #include "chrome/browser/autofill/autofill_profile.h"
22 #include "chrome/browser/autofill/credit_card.h" 22 #include "chrome/browser/autofill/credit_card.h"
23 #include "chrome/browser/autofill/personal_data_manager.h" 23 #include "chrome/browser/autofill/personal_data_manager.h"
24 #include "chrome/browser/autofill/personal_data_manager_factory.h" 24 #include "chrome/browser/autofill/personal_data_manager_factory.h"
25 #include "chrome/browser/autofill/test_autofill_external_delegate.h" 25 #include "chrome/browser/autofill/test_autofill_external_delegate.h"
26 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/sync/profile_sync_service.h" 27 #include "chrome/browser/sync/profile_sync_service.h"
28 #include "chrome/browser/sync/profile_sync_service_factory.h" 28 #include "chrome/browser/sync/profile_sync_service_factory.h"
29 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h"
29 #include "chrome/browser/ui/browser.h" 30 #include "chrome/browser/ui/browser.h"
30 #include "chrome/browser/ui/tab_contents/tab_contents.h" 31 #include "chrome/browser/ui/tab_contents/tab_contents.h"
31 #include "chrome/browser/ui/tab_contents/test_tab_contents.h" 32 #include "chrome/browser/ui/tab_contents/test_tab_contents.h"
32 #include "chrome/common/autofill_messages.h" 33 #include "chrome/common/autofill_messages.h"
33 #include "chrome/common/chrome_switches.h" 34 #include "chrome/common/chrome_switches.h"
34 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
35 #include "chrome/test/base/testing_profile.h" 36 #include "chrome/test/base/testing_profile.h"
36 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
37 #include "content/public/test/mock_render_process_host.h" 38 #include "content/public/test/mock_render_process_host.h"
38 #include "content/public/test/test_browser_thread.h" 39 #include "content/public/test/test_browser_thread.h"
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 ExpectFilledForm(page_id, filled_form, expected_page_id, 436 ExpectFilledForm(page_id, filled_form, expected_page_id,
436 "", "", "", "", "", "", "", "", "", "", "", 437 "", "", "", "", "", "", "", "", "", "", "",
437 "Miku Hatsune", "4234567890654321", month, year, 438 "Miku Hatsune", "4234567890654321", month, year,
438 has_address_fields, true, true); 439 has_address_fields, true, true);
439 } 440 }
440 441
441 class TestAutofillManager : public AutofillManager { 442 class TestAutofillManager : public AutofillManager {
442 public: 443 public:
443 TestAutofillManager(TabContents* tab_contents, 444 TestAutofillManager(TabContents* tab_contents,
444 TestPersonalDataManager* personal_data) 445 TestPersonalDataManager* personal_data)
445 : AutofillManager(tab_contents, personal_data), 446 : AutofillManager(&delegate_, tab_contents, personal_data),
447 delegate_(tab_contents),
446 personal_data_(personal_data), 448 personal_data_(personal_data),
447 autofill_enabled_(true), 449 autofill_enabled_(true),
448 did_finish_async_form_submit_(false), 450 did_finish_async_form_submit_(false),
449 message_loop_is_running_(false) { 451 message_loop_is_running_(false) {
450 } 452 }
451 453
452 virtual bool IsAutofillEnabled() const OVERRIDE { return autofill_enabled_; } 454 virtual bool IsAutofillEnabled() const OVERRIDE { return autofill_enabled_; }
453 455
454 void set_autofill_enabled(bool autofill_enabled) { 456 void set_autofill_enabled(bool autofill_enabled) {
455 autofill_enabled_ = autofill_enabled; 457 autofill_enabled_ = autofill_enabled;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 } 558 }
557 559
558 void AddSeenForm(FormStructure* form) { 560 void AddSeenForm(FormStructure* form) {
559 form_structures()->push_back(form); 561 form_structures()->push_back(form);
560 } 562 }
561 563
562 private: 564 private:
563 // AutofillManager is ref counted. 565 // AutofillManager is ref counted.
564 virtual ~TestAutofillManager() {} 566 virtual ~TestAutofillManager() {}
565 567
568 TabAutofillManagerDelegate delegate_;
569
566 // Weak reference. 570 // Weak reference.
567 TestPersonalDataManager* personal_data_; 571 TestPersonalDataManager* personal_data_;
568 572
569 bool autofill_enabled_; 573 bool autofill_enabled_;
570 574
571 bool did_finish_async_form_submit_; 575 bool did_finish_async_form_submit_;
572 bool message_loop_is_running_; 576 bool message_loop_is_running_;
573 577
574 std::string submitted_form_signature_; 578 std::string submitted_form_signature_;
575 std::vector<FieldTypeSet> expected_submitted_field_types_; 579 std::vector<FieldTypeSet> expected_submitted_field_types_;
(...skipping 2551 matching lines...) Expand 10 before | Expand all | Expand 10 after
3127 3131
3128 AutofillManager* autofill_manager = tab_contents()->autofill_manager(); 3132 AutofillManager* autofill_manager = tab_contents()->autofill_manager();
3129 EXPECT_TRUE(autofill_manager->external_delegate()); 3133 EXPECT_TRUE(autofill_manager->external_delegate());
3130 3134
3131 AutocompleteHistoryManager* autocomplete_history_manager = 3135 AutocompleteHistoryManager* autocomplete_history_manager =
3132 tab_contents()->autocomplete_history_manager(); 3136 tab_contents()->autocomplete_history_manager();
3133 EXPECT_TRUE(autocomplete_history_manager->external_delegate()); 3137 EXPECT_TRUE(autocomplete_history_manager->external_delegate());
3134 } 3138 }
3135 3139
3136 #endif // OS_ANDROID 3140 #endif // OS_ANDROID
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_manager.cc ('k') | chrome/browser/autofill/autofill_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698