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

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

Issue 707173004: Refactor Autofill for out of process iframes (OOPIF). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: FirstUserGesture Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "chrome/browser/browser_process.h" 6 #include "chrome/browser/browser_process.h"
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_tabstrip.h" 8 #include "chrome/browser/ui/browser_tabstrip.h"
9 #include "chrome/browser/ui/tabs/tab_strip_model.h" 9 #include "chrome/browser/ui/tabs/tab_strip_model.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 private: 51 private:
52 TestingPrefServiceSyncable prefs_; 52 TestingPrefServiceSyncable prefs_;
53 53
54 DISALLOW_COPY_AND_ASSIGN(MockAutofillClient); 54 DISALLOW_COPY_AND_ASSIGN(MockAutofillClient);
55 }; 55 };
56 56
57 // Subclass ContentAutofillDriver so we can create an ContentAutofillDriver 57 // Subclass ContentAutofillDriver so we can create an ContentAutofillDriver
58 // instance. 58 // instance.
59 class TestContentAutofillDriver : public ContentAutofillDriver { 59 class TestContentAutofillDriver : public ContentAutofillDriver {
60 public: 60 public:
61 TestContentAutofillDriver(content::WebContents* web_contents, 61 TestContentAutofillDriver(content::RenderFrameHost* rfh,
62 AutofillClient* client) 62 AutofillClient* client)
63 : ContentAutofillDriver( 63 : ContentAutofillDriver(
64 web_contents, 64 rfh,
65 client, 65 client,
66 g_browser_process->GetApplicationLocale(), 66 g_browser_process->GetApplicationLocale(),
67 AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER) {} 67 AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER) {}
68 ~TestContentAutofillDriver() override {} 68 ~TestContentAutofillDriver() override {}
69 69
70 private: 70 private:
71 DISALLOW_COPY_AND_ASSIGN(TestContentAutofillDriver); 71 DISALLOW_COPY_AND_ASSIGN(TestContentAutofillDriver);
72 }; 72 };
73 73
74 } // namespace 74 } // namespace
75 75
76 class ContentAutofillDriverBrowserTest : public InProcessBrowserTest, 76 class ContentAutofillDriverBrowserTest : public InProcessBrowserTest,
77 public content::WebContentsObserver { 77 public content::WebContentsObserver {
78 public: 78 public:
79 ContentAutofillDriverBrowserTest() {} 79 ContentAutofillDriverBrowserTest() {}
80 virtual ~ContentAutofillDriverBrowserTest() {} 80 virtual ~ContentAutofillDriverBrowserTest() {}
81 81
82 virtual void SetUpOnMainThread() override { 82 virtual void SetUpOnMainThread() override {
83 content::WebContents* web_contents = 83 content::WebContents* web_contents =
84 browser()->tab_strip_model()->GetActiveWebContents(); 84 browser()->tab_strip_model()->GetActiveWebContents();
85 ASSERT_TRUE(web_contents != NULL); 85 ASSERT_TRUE(web_contents != NULL);
86 Observe(web_contents); 86 Observe(web_contents);
87 AutofillManager::RegisterProfilePrefs(autofill_client_.GetPrefRegistry()); 87 AutofillManager::RegisterProfilePrefs(autofill_client_.GetPrefRegistry());
88 88
89 autofill_driver_.reset( 89 autofill_driver_.reset(new TestContentAutofillDriver(
90 new TestContentAutofillDriver(web_contents, &autofill_client_)); 90 web_contents->GetMainFrame(), &autofill_client_));
91 } 91 }
92 92
93 // Normally the WebContents will automatically delete the driver, but here 93 // Normally the WebContents will automatically delete the driver, but here
94 // the driver is owned by this test, so we have to manually destroy. 94 // the driver is owned by this test, so we have to manually destroy.
95 virtual void WebContentsDestroyed() override { 95 virtual void WebContentsDestroyed() override {
96 autofill_driver_.reset(); 96 autofill_driver_.reset();
97 } 97 }
98 98
99 virtual void WasHidden() override { 99 virtual void WasHidden() override {
100 if (!web_contents_hidden_callback_.is_null()) 100 if (!web_contents_hidden_callback_.is_null())
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 browser()->OpenURL(content::OpenURLParams(GURL(chrome::kChromeUIAboutURL), 150 browser()->OpenURL(content::OpenURLParams(GURL(chrome::kChromeUIAboutURL),
151 content::Referrer(), 151 content::Referrer(),
152 CURRENT_TAB, 152 CURRENT_TAB,
153 ui::PAGE_TRANSITION_TYPED, 153 ui::PAGE_TRANSITION_TYPED,
154 false)); 154 false));
155 runner->Run(); 155 runner->Run();
156 nav_entry_committed_callback_.Reset(); 156 nav_entry_committed_callback_.Reset();
157 } 157 }
158 158
159 } // namespace autofill 159 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698