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

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

Issue 10546054: TabContentsWrapper -> TabContents, part 5. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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/autocomplete_history_manager.h" 17 #include "chrome/browser/autocomplete_history_manager.h"
18 #include "chrome/browser/autofill/autofill_common_test.h" 18 #include "chrome/browser/autofill/autofill_common_test.h"
19 #include "chrome/browser/autofill/autofill_manager.h" 19 #include "chrome/browser/autofill/autofill_manager.h"
20 #include "chrome/browser/autofill/autofill_profile.h" 20 #include "chrome/browser/autofill/autofill_profile.h"
21 #include "chrome/browser/autofill/credit_card.h" 21 #include "chrome/browser/autofill/credit_card.h"
22 #include "chrome/browser/autofill/personal_data_manager.h" 22 #include "chrome/browser/autofill/personal_data_manager.h"
23 #include "chrome/browser/autofill/personal_data_manager_factory.h" 23 #include "chrome/browser/autofill/personal_data_manager_factory.h"
24 #include "chrome/browser/autofill/test_autofill_external_delegate.h" 24 #include "chrome/browser/autofill/test_autofill_external_delegate.h"
25 #include "chrome/browser/prefs/pref_service.h" 25 #include "chrome/browser/prefs/pref_service.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/ui/browser.h" 28 #include "chrome/browser/ui/browser.h"
29 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 29 #include "chrome/browser/ui/tab_contents/tab_contents.h"
30 #include "chrome/browser/ui/tab_contents/test_tab_contents.h" 30 #include "chrome/browser/ui/tab_contents/test_tab_contents.h"
31 #include "chrome/common/autofill_messages.h" 31 #include "chrome/common/autofill_messages.h"
32 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/pref_names.h" 33 #include "chrome/common/pref_names.h"
34 #include "chrome/test/base/testing_profile.h" 34 #include "chrome/test/base/testing_profile.h"
35 #include "content/public/browser/web_contents.h" 35 #include "content/public/browser/web_contents.h"
36 #include "content/public/test/mock_render_process_host.h" 36 #include "content/public/test/mock_render_process_host.h"
37 #include "content/public/test/test_browser_thread.h" 37 #include "content/public/test/test_browser_thread.h"
38 #include "googleurl/src/gurl.h" 38 #include "googleurl/src/gurl.h"
39 #include "grit/generated_resources.h" 39 #include "grit/generated_resources.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 const char* year, 432 const char* year,
433 const char* month) { 433 const char* month) {
434 ExpectFilledForm(page_id, filled_form, expected_page_id, 434 ExpectFilledForm(page_id, filled_form, expected_page_id,
435 "", "", "", "", "", "", "", "", "", "", "", 435 "", "", "", "", "", "", "", "", "", "", "",
436 "Miku Hatsune", "4234567890654321", month, year, 436 "Miku Hatsune", "4234567890654321", month, year,
437 has_address_fields, true, true); 437 has_address_fields, true, true);
438 } 438 }
439 439
440 class TestAutofillManager : public AutofillManager { 440 class TestAutofillManager : public AutofillManager {
441 public: 441 public:
442 TestAutofillManager(TabContentsWrapper* tab_contents, 442 TestAutofillManager(TabContents* tab_contents,
443 TestPersonalDataManager* personal_data) 443 TestPersonalDataManager* personal_data)
444 : AutofillManager(tab_contents, personal_data), 444 : AutofillManager(tab_contents, personal_data),
445 personal_data_(personal_data), 445 personal_data_(personal_data),
446 autofill_enabled_(true), 446 autofill_enabled_(true),
447 did_finish_async_form_submit_(false), 447 did_finish_async_form_submit_(false),
448 message_loop_is_running_(false) { 448 message_loop_is_running_(false) {
449 } 449 }
450 450
451 virtual bool IsAutofillEnabled() const OVERRIDE { return autofill_enabled_; } 451 virtual bool IsAutofillEnabled() const OVERRIDE { return autofill_enabled_; }
452 452
(...skipping 2613 matching lines...) Expand 10 before | Expand all | Expand 10 after
3066 // TODO(csharp): Currently variants should not be deleted, but once they are 3066 // TODO(csharp): Currently variants should not be deleted, but once they are
3067 // update these expectations. 3067 // update these expectations.
3068 // http://crbug.com/124211 3068 // http://crbug.com/124211
3069 EXPECT_TRUE(autofill_manager_->GetProfileWithGUID(guid.c_str())); 3069 EXPECT_TRUE(autofill_manager_->GetProfileWithGUID(guid.c_str()));
3070 } 3070 }
3071 3071
3072 namespace { 3072 namespace {
3073 3073
3074 class MockAutofillExternalDelegate : public TestAutofillExternalDelegate { 3074 class MockAutofillExternalDelegate : public TestAutofillExternalDelegate {
3075 public: 3075 public:
3076 explicit MockAutofillExternalDelegate(TabContentsWrapper* wrapper, 3076 explicit MockAutofillExternalDelegate(TabContents* tab_contents,
3077 AutofillManager* autofill_manager) 3077 AutofillManager* autofill_manager)
3078 : TestAutofillExternalDelegate(wrapper, autofill_manager) {} 3078 : TestAutofillExternalDelegate(tab_contents, autofill_manager) {}
3079 virtual ~MockAutofillExternalDelegate() {} 3079 virtual ~MockAutofillExternalDelegate() {}
3080 3080
3081 MOCK_METHOD5(OnQuery, void(int query_id, 3081 MOCK_METHOD5(OnQuery, void(int query_id,
3082 const webkit::forms::FormData& form, 3082 const webkit::forms::FormData& form,
3083 const webkit::forms::FormField& field, 3083 const webkit::forms::FormField& field,
3084 const gfx::Rect& bounds, 3084 const gfx::Rect& bounds,
3085 bool display_warning)); 3085 bool display_warning));
3086 3086
3087 virtual void OnQueryPlatformSpecific(int query_id, 3087 virtual void OnQueryPlatformSpecific(int query_id,
3088 const webkit::forms::FormData& form, 3088 const webkit::forms::FormData& form,
(...skipping 27 matching lines...) Expand all
3116 // OS_ANDROID defines an external delegate, but prerequisites for 3116 // OS_ANDROID defines an external delegate, but prerequisites for
3117 // landing autofill_external_delegate_android.cc in the Chromium tree 3117 // landing autofill_external_delegate_android.cc in the Chromium tree
3118 // have not themselves landed. 3118 // have not themselves landed.
3119 3119
3120 // Turn on the external delegate. Recreate a WebContents. Make sure 3120 // Turn on the external delegate. Recreate a WebContents. Make sure
3121 // an external delegate was set in the proper structures. 3121 // an external delegate was set in the proper structures.
3122 TEST_F(AutofillManagerTest, TestTabContentsWithExternalDelegate) { 3122 TEST_F(AutofillManagerTest, TestTabContentsWithExternalDelegate) {
3123 CommandLine::ForCurrentProcess()->AppendSwitch( 3123 CommandLine::ForCurrentProcess()->AppendSwitch(
3124 switches::kExternalAutofillPopup); 3124 switches::kExternalAutofillPopup);
3125 3125
3126 // Setting the contents creates a new TabContentsWrapper. 3126 // Setting the contents creates a new TabContents.
3127 WebContents* contents = CreateTestWebContents(); 3127 WebContents* contents = CreateTestWebContents();
3128 SetContents(contents); 3128 SetContents(contents);
3129 3129
3130 AutofillManager* autofill_manager = tab_contents()->autofill_manager(); 3130 AutofillManager* autofill_manager = tab_contents()->autofill_manager();
3131 EXPECT_TRUE(autofill_manager->external_delegate()); 3131 EXPECT_TRUE(autofill_manager->external_delegate());
3132 3132
3133 AutocompleteHistoryManager* autocomplete_history_manager = 3133 AutocompleteHistoryManager* autocomplete_history_manager =
3134 tab_contents()->autocomplete_history_manager(); 3134 tab_contents()->autocomplete_history_manager();
3135 EXPECT_TRUE(autocomplete_history_manager->external_delegate()); 3135 EXPECT_TRUE(autocomplete_history_manager->external_delegate());
3136 } 3136 }
3137 3137
3138 #endif // OS_ANDROID 3138 #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