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

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

Issue 10910071: Extract abstract base to API directory for ProfileSyncService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More unit test fixes. 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"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 const char* year, 434 const char* year,
435 const char* month) { 435 const char* month) {
436 ExpectFilledForm(page_id, filled_form, expected_page_id, 436 ExpectFilledForm(page_id, filled_form, expected_page_id,
437 "", "", "", "", "", "", "", "", "", "", "", 437 "", "", "", "", "", "", "", "", "", "", "",
438 "Miku Hatsune", "4234567890654321", month, year, 438 "Miku Hatsune", "4234567890654321", month, year,
439 has_address_fields, true, true); 439 has_address_fields, true, true);
440 } 440 }
441 441
442 class TestAutofillManager : public AutofillManager { 442 class TestAutofillManager : public AutofillManager {
443 public: 443 public:
444 TestAutofillManager(TabContents* tab_contents, 444 TestAutofillManager(autofill::AutofillManagerDelegate* delegate,
445 TabContents* tab_contents,
445 TestPersonalDataManager* personal_data) 446 TestPersonalDataManager* personal_data)
446 : AutofillManager(&delegate_, tab_contents, personal_data), 447 : AutofillManager(delegate, tab_contents, personal_data),
447 delegate_(tab_contents),
448 personal_data_(personal_data), 448 personal_data_(personal_data),
449 autofill_enabled_(true), 449 autofill_enabled_(true),
450 did_finish_async_form_submit_(false), 450 did_finish_async_form_submit_(false),
451 message_loop_is_running_(false) { 451 message_loop_is_running_(false) {
452 } 452 }
453 453
454 virtual bool IsAutofillEnabled() const OVERRIDE { return autofill_enabled_; } 454 virtual bool IsAutofillEnabled() const OVERRIDE { return autofill_enabled_; }
455 455
456 void set_autofill_enabled(bool autofill_enabled) { 456 void set_autofill_enabled(bool autofill_enabled) {
457 autofill_enabled_ = autofill_enabled; 457 autofill_enabled_ = autofill_enabled;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 } 558 }
559 559
560 void AddSeenForm(FormStructure* form) { 560 void AddSeenForm(FormStructure* form) {
561 form_structures()->push_back(form); 561 form_structures()->push_back(form);
562 } 562 }
563 563
564 private: 564 private:
565 // AutofillManager is ref counted. 565 // AutofillManager is ref counted.
566 virtual ~TestAutofillManager() {} 566 virtual ~TestAutofillManager() {}
567 567
568 TabAutofillManagerDelegate delegate_;
569
570 // Weak reference. 568 // Weak reference.
571 TestPersonalDataManager* personal_data_; 569 TestPersonalDataManager* personal_data_;
572 570
573 bool autofill_enabled_; 571 bool autofill_enabled_;
574 572
575 bool did_finish_async_form_submit_; 573 bool did_finish_async_form_submit_;
576 bool message_loop_is_running_; 574 bool message_loop_is_running_;
577 575
578 std::string submitted_form_signature_; 576 std::string submitted_form_signature_;
579 std::vector<FieldTypeSet> expected_submitted_field_types_; 577 std::vector<FieldTypeSet> expected_submitted_field_types_;
(...skipping 20 matching lines...) Expand all
600 autofill_manager_ = NULL; 598 autofill_manager_ = NULL;
601 } 599 }
602 600
603 virtual void SetUp() OVERRIDE { 601 virtual void SetUp() OVERRIDE {
604 Profile* profile = new TestingProfile(); 602 Profile* profile = new TestingProfile();
605 browser_context_.reset(profile); 603 browser_context_.reset(profile);
606 PersonalDataManagerFactory::GetInstance()->SetTestingFactory( 604 PersonalDataManagerFactory::GetInstance()->SetTestingFactory(
607 profile, TestPersonalDataManager::Build); 605 profile, TestPersonalDataManager::Build);
608 606
609 TabContentsTestHarness::SetUp(); 607 TabContentsTestHarness::SetUp();
610 autofill_manager_ = new TestAutofillManager(tab_contents(), 608 manager_delegate_.reset(new TabAutofillManagerDelegate(tab_contents()));
609 autofill_manager_ = new TestAutofillManager(manager_delegate_.get(),
610 tab_contents(),
611 &personal_data_); 611 &personal_data_);
612 612
613 file_thread_.Start(); 613 file_thread_.Start();
614 } 614 }
615 615
616 virtual void TearDown() OVERRIDE { 616 virtual void TearDown() OVERRIDE {
617 file_thread_.Stop(); 617 file_thread_.Stop();
618 TabContentsTestHarness::TearDown(); 618 TabContentsTestHarness::TearDown();
619 } 619 }
620 620
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 *results = autofill_param.b; 705 *results = autofill_param.b;
706 706
707 process()->sink().ClearMessages(); 707 process()->sink().ClearMessages();
708 return true; 708 return true;
709 } 709 }
710 710
711 protected: 711 protected:
712 content::TestBrowserThread ui_thread_; 712 content::TestBrowserThread ui_thread_;
713 content::TestBrowserThread file_thread_; 713 content::TestBrowserThread file_thread_;
714 714
715 scoped_ptr<TabAutofillManagerDelegate> manager_delegate_;
715 scoped_refptr<TestAutofillManager> autofill_manager_; 716 scoped_refptr<TestAutofillManager> autofill_manager_;
716 TestPersonalDataManager personal_data_; 717 TestPersonalDataManager personal_data_;
717 718
718 // Used when we want an off the record profile. This will store the original 719 // Used when we want an off the record profile. This will store the original
719 // profile from which the off the record profile is derived. 720 // profile from which the off the record profile is derived.
720 scoped_ptr<Profile> other_browser_context_; 721 scoped_ptr<Profile> other_browser_context_;
721 722
722 private: 723 private:
723 DISALLOW_COPY_AND_ASSIGN(AutofillManagerTest); 724 DISALLOW_COPY_AND_ASSIGN(AutofillManagerTest);
724 }; 725 };
(...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after
3131 3132
3132 AutofillManager* autofill_manager = tab_contents()->autofill_manager(); 3133 AutofillManager* autofill_manager = tab_contents()->autofill_manager();
3133 EXPECT_TRUE(autofill_manager->external_delegate()); 3134 EXPECT_TRUE(autofill_manager->external_delegate());
3134 3135
3135 AutocompleteHistoryManager* autocomplete_history_manager = 3136 AutocompleteHistoryManager* autocomplete_history_manager =
3136 tab_contents()->autocomplete_history_manager(); 3137 tab_contents()->autocomplete_history_manager();
3137 EXPECT_TRUE(autocomplete_history_manager->external_delegate()); 3138 EXPECT_TRUE(autocomplete_history_manager->external_delegate());
3138 } 3139 }
3139 3140
3140 #endif // OS_ANDROID 3141 #endif // OS_ANDROID
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_manager_delegate.h ('k') | chrome/browser/autofill/autofill_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698