| OLD | NEW |
| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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( |
| 90 new TestContentAutofillDriver(web_contents, &autofill_client_)); | 90 new TestContentAutofillDriver(web_contents, &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()) |
| 101 web_contents_hidden_callback_.Run(); | 101 web_contents_hidden_callback_.Run(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 virtual void NavigationEntryCommitted( | 104 virtual void NavigationEntryCommitted( |
| 105 const content::LoadCommittedDetails& load_details) OVERRIDE { | 105 const content::LoadCommittedDetails& load_details) override { |
| 106 if (!nav_entry_committed_callback_.is_null()) | 106 if (!nav_entry_committed_callback_.is_null()) |
| 107 nav_entry_committed_callback_.Run(); | 107 nav_entry_committed_callback_.Run(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 protected: | 110 protected: |
| 111 content::WebContents* web_contents_; | 111 content::WebContents* web_contents_; |
| 112 | 112 |
| 113 base::Closure web_contents_hidden_callback_; | 113 base::Closure web_contents_hidden_callback_; |
| 114 base::Closure nav_entry_committed_callback_; | 114 base::Closure nav_entry_committed_callback_; |
| 115 | 115 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |