OLD | NEW |
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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/autofill/test_autofill_external_delegate.h" | 23 #include "chrome/browser/autofill/test_autofill_external_delegate.h" |
24 #include "chrome/browser/prefs/pref_service.h" | 24 #include "chrome/browser/prefs/pref_service.h" |
25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
28 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" | 28 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" |
29 #include "chrome/common/autofill_messages.h" | 29 #include "chrome/common/autofill_messages.h" |
30 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
31 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
32 #include "chrome/test/base/testing_profile.h" | 32 #include "chrome/test/base/testing_profile.h" |
33 #include "content/browser/tab_contents/test_tab_contents.h" | 33 #include "content/public/browser/web_contents.h" |
34 #include "content/test/mock_render_process_host.h" | 34 #include "content/test/mock_render_process_host.h" |
35 #include "content/test/test_browser_thread.h" | 35 #include "content/test/test_browser_thread.h" |
36 #include "googleurl/src/gurl.h" | 36 #include "googleurl/src/gurl.h" |
37 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
38 #include "ipc/ipc_test_sink.h" | 38 #include "ipc/ipc_test_sink.h" |
39 #include "testing/gmock/include/gmock/gmock.h" | 39 #include "testing/gmock/include/gmock/gmock.h" |
40 #include "testing/gtest/include/gtest/gtest.h" | 40 #include "testing/gtest/include/gtest/gtest.h" |
41 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
42 #include "ui/gfx/rect.h" | 42 #include "ui/gfx/rect.h" |
43 #include "webkit/forms/form_data.h" | 43 #include "webkit/forms/form_data.h" |
44 #include "webkit/forms/form_field.h" | 44 #include "webkit/forms/form_field.h" |
45 | 45 |
46 using content::BrowserThread; | 46 using content::BrowserThread; |
| 47 using content::WebContents; |
47 using testing::_; | 48 using testing::_; |
48 using webkit::forms::FormData; | 49 using webkit::forms::FormData; |
49 using webkit::forms::FormField; | 50 using webkit::forms::FormField; |
50 | 51 |
51 namespace { | 52 namespace { |
52 | 53 |
53 // The page ID sent to the AutofillManager from the RenderView, used to send | 54 // The page ID sent to the AutofillManager from the RenderView, used to send |
54 // an IPC message back to the renderer. | 55 // an IPC message back to the renderer. |
55 const int kDefaultPageID = 137; | 56 const int kDefaultPageID = 137; |
56 | 57 |
(...skipping 2852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2909 // landing autofill_external_delegate_android.cc in the Chromium tree | 2910 // landing autofill_external_delegate_android.cc in the Chromium tree |
2910 // have not themselves landed. | 2911 // have not themselves landed. |
2911 | 2912 |
2912 // Turn on the external delegate. Recreate a TabContents. Make sure | 2913 // Turn on the external delegate. Recreate a TabContents. Make sure |
2913 // an external delegate was set in the proper structures. | 2914 // an external delegate was set in the proper structures. |
2914 TEST_F(AutofillManagerTest, TestTabContentsWithExternalDelegate) { | 2915 TEST_F(AutofillManagerTest, TestTabContentsWithExternalDelegate) { |
2915 CommandLine::ForCurrentProcess()->AppendSwitch( | 2916 CommandLine::ForCurrentProcess()->AppendSwitch( |
2916 switches::kExternalAutofillPopup); | 2917 switches::kExternalAutofillPopup); |
2917 | 2918 |
2918 // Setting the contents creates a new TabContentsWrapper. | 2919 // Setting the contents creates a new TabContentsWrapper. |
2919 TestTabContents* contents = CreateTestTabContents(); | 2920 WebContents* contents = CreateTestWebContents(); |
2920 SetContents(contents); | 2921 SetContents(contents); |
2921 | 2922 |
2922 AutofillManager* autofill_manager = contents_wrapper()->autofill_manager(); | 2923 AutofillManager* autofill_manager = contents_wrapper()->autofill_manager(); |
2923 EXPECT_TRUE(autofill_manager->external_delegate()); | 2924 EXPECT_TRUE(autofill_manager->external_delegate()); |
2924 | 2925 |
2925 AutocompleteHistoryManager* autocomplete_history_manager = | 2926 AutocompleteHistoryManager* autocomplete_history_manager = |
2926 contents_wrapper()->autocomplete_history_manager(); | 2927 contents_wrapper()->autocomplete_history_manager(); |
2927 EXPECT_TRUE(autocomplete_history_manager->external_delegate()); | 2928 EXPECT_TRUE(autocomplete_history_manager->external_delegate()); |
2928 } | 2929 } |
2929 | 2930 |
2930 #endif // OS_ANDROID | 2931 #endif // OS_ANDROID |
OLD | NEW |