Index: chrome/browser/autofill/autofill_external_delegate_browsertest.cc |
diff --git a/chrome/browser/autofill/autofill_external_delegate_browsertest.cc b/chrome/browser/autofill/autofill_external_delegate_browsertest.cc |
index 996f19acd4dad818e9c1aee679b71451a7074af0..b7e4407ff99c49cfadec28864a833c84d40c7bb1 100644 |
--- a/chrome/browser/autofill/autofill_external_delegate_browsertest.cc |
+++ b/chrome/browser/autofill/autofill_external_delegate_browsertest.cc |
@@ -19,13 +19,9 @@ |
#include "content/public/browser/web_contents.h" |
#include "content/public/common/url_constants.h" |
#include "content/public/test/test_utils.h" |
-#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "ui/gfx/rect.h" |
-using ::testing::AtLeast; |
-using testing::_; |
- |
namespace { |
class MockAutofillExternalDelegate : public AutofillExternalDelegate { |
@@ -33,7 +29,8 @@ class MockAutofillExternalDelegate : public AutofillExternalDelegate { |
explicit MockAutofillExternalDelegate(content::WebContents* web_contents) |
: AutofillExternalDelegate( |
web_contents, |
- AutofillManager::FromWebContents(web_contents)) {} |
+ AutofillManager::FromWebContents(web_contents)), |
+ popup_hidden_(true) {} |
~MockAutofillExternalDelegate() {} |
virtual void DidSelectSuggestion(int unique_id) OVERRIDE {} |
@@ -44,7 +41,29 @@ class MockAutofillExternalDelegate : public AutofillExternalDelegate { |
return controller(); |
} |
- MOCK_METHOD0(HideAutofillPopup, void()); |
+ virtual void ApplyAutofillSuggestions( |
+ const std::vector<string16>& autofill_values, |
+ const std::vector<string16>& autofill_labels, |
+ const std::vector<string16>& autofill_icons, |
+ const std::vector<int>& autofill_unique_ids) { |
Ilya Sherman
2013/02/15 05:57:55
nit: OVERRIDE
csharp
2013/02/15 14:52:27
Done.
|
+ popup_hidden_ = false; |
+ |
+ AutofillExternalDelegate::ApplyAutofillSuggestions(autofill_values, |
+ autofill_labels, |
+ autofill_icons, |
+ autofill_unique_ids); |
+ } |
+ |
+ virtual void HideAutofillPopup() OVERRIDE { |
+ popup_hidden_ = true; |
+ |
+ AutofillExternalDelegate::HideAutofillPopup(); |
+ } |
+ |
+ bool popup_hidden() const { return popup_hidden_; } |
+ |
+ private: |
+ bool popup_hidden_; |
}; |
} // namespace |
@@ -80,9 +99,6 @@ class AutofillExternalDelegateBrowserTest |
IN_PROC_BROWSER_TEST_F(AutofillExternalDelegateBrowserTest, |
SwitchTabAndHideAutofillPopup) { |
- EXPECT_CALL(*autofill_external_delegate_, |
- HideAutofillPopup()).Times(AtLeast(1)); |
- |
autofill::GenerateTestAutofillPopup(autofill_external_delegate_.get()); |
content::WindowedNotificationObserver observer( |
@@ -92,16 +108,15 @@ IN_PROC_BROWSER_TEST_F(AutofillExternalDelegateBrowserTest, |
content::PAGE_TRANSITION_AUTO_TOPLEVEL); |
observer.Wait(); |
- // The mock verifies that the call was made. |
+ EXPECT_TRUE(autofill_external_delegate_->popup_hidden()); |
} |
IN_PROC_BROWSER_TEST_F(AutofillExternalDelegateBrowserTest, |
TestPageNavigationHidingAutofillPopup) { |
- EXPECT_CALL(*autofill_external_delegate_, |
- HideAutofillPopup()).Times(AtLeast(1)); |
- |
autofill::GenerateTestAutofillPopup(autofill_external_delegate_.get()); |
+ EXPECT_FALSE(autofill_external_delegate_->popup_hidden()); |
+ |
content::WindowedNotificationObserver observer( |
content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
content::Source<content::NavigationController>( |
@@ -109,12 +124,9 @@ IN_PROC_BROWSER_TEST_F(AutofillExternalDelegateBrowserTest, |
browser()->OpenURL(content::OpenURLParams( |
GURL(chrome::kAboutBlankURL), content::Referrer(), |
CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); |
- browser()->OpenURL(content::OpenURLParams( |
- GURL(chrome::kChromeUIAboutURL), content::Referrer(), |
- CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); |
Ilya Sherman
2013/02/15 05:57:55
Let's leave this navigation, and get rid of the ot
csharp
2013/02/15 14:52:27
Added this one back and change the blank page to t
|
observer.Wait(); |
- // The mock verifies that the call was made. |
+ EXPECT_TRUE(autofill_external_delegate_->popup_hidden()); |
} |
// Tests that closing the widget does not leak any resources. This test is |