Chromium Code Reviews| Index: chrome/browser/ui/views/autofill/autofill_external_delegate_views_browsertest.cc |
| diff --git a/chrome/browser/ui/views/autofill/autofill_external_delegate_views_browsertest.cc b/chrome/browser/ui/views/autofill/autofill_external_delegate_views_browsertest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f408e776847c828ddc625ff35a84960bae1c0309 |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/autofill/autofill_external_delegate_views_browsertest.cc |
| @@ -0,0 +1,47 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/ui/views/autofill/autofill_external_delegate_views.h" |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "chrome/browser/ui/tab_contents/tab_contents.h" |
| +#include "chrome/browser/ui/browser_tabstrip.h" |
| +#include "chrome/test/base/in_process_browser_test.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| +#include "ui/gfx/rect.h" |
| + |
| +class AutofillExternalDelegateViewsBrowserTest : public InProcessBrowserTest { |
|
sky
2012/08/16 23:02:01
use a typedef so that you don't need a class.
csharp
2012/08/20 20:59:00
Done.
|
| + public: |
| + AutofillExternalDelegateViewsBrowserTest() {} |
| + virtual ~AutofillExternalDelegateViewsBrowserTest() {} |
| +}; |
| + |
| +IN_PROC_BROWSER_TEST_F(AutofillExternalDelegateViewsBrowserTest, |
| + OpenAndClosePopup) { |
| + TabContents* tab_contents_ = chrome::GetActiveTabContents(browser()); |
| + ASSERT_TRUE(tab_contents_ != NULL); |
| + |
| + scoped_ptr<AutofillExternalDelegate> autofill_external_delegate_( |
| + AutofillExternalDelegate::Create(tab_contents_, NULL)); |
| + |
| + int query_id = 1; |
| + webkit::forms::FormData form; |
| + webkit::forms::FormField field; |
| + field.is_focusable = true; |
| + field.should_autocomplete = true; |
| + gfx::Rect bounds(100, 100); |
| + |
| + // Ensure that we can populate the popup through the delegate without any |
| + // and then close it. |
| + autofill_external_delegate_->OnQuery(query_id, form, field, bounds, false); |
| + |
| + std::vector<string16> autofill_item; |
| + autofill_item.push_back(string16()); |
| + std::vector<int> autofill_id; |
| + autofill_id.push_back(0); |
| + autofill_external_delegate_->OnSuggestionsReturned( |
| + query_id, autofill_item, autofill_item, autofill_item, autofill_id); |
| + |
| + autofill_external_delegate_->HideAutofillPopup(); |
| +} |