Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/views/autofill/autofill_external_delegate_views.h" | |
| 6 | |
| 7 #include "base/memory/scoped_ptr.h" | |
| 8 #include "chrome/browser/ui/tab_contents/tab_contents.h" | |
| 9 #include "chrome/browser/ui/browser_tabstrip.h" | |
| 10 #include "chrome/test/base/in_process_browser_test.h" | |
| 11 #include "testing/gtest/include/gtest/gtest.h" | |
| 12 #include "ui/gfx/rect.h" | |
| 13 | |
| 14 class AutofillExternalDelegateViewsBrowserTest : public InProcessBrowserTest { | |
| 15 public: | |
| 16 AutofillExternalDelegateViewsBrowserTest() {} | |
| 17 virtual ~AutofillExternalDelegateViewsBrowserTest() {} | |
| 18 | |
| 19 virtual void SetUpOnMainThread() OVERRIDE { | |
| 20 tab_contents_ = chrome::GetActiveTabContents(browser()); | |
|
sky
2012/08/15 21:07:29
Any reason this is here and not in the test?
csharp
2012/08/16 19:16:27
Just to allow future tests to have these values al
sky
2012/08/16 20:00:15
I would move it to the test for now. You can promo
csharp
2012/08/16 21:39:15
Done.
| |
| 21 ASSERT_TRUE(tab_contents_ != NULL); | |
| 22 | |
| 23 autofill_external_delegate_.reset( | |
| 24 AutofillExternalDelegate::Create(tab_contents_, NULL)); | |
| 25 } | |
| 26 | |
| 27 protected: | |
| 28 TabContents* tab_contents_; | |
| 29 scoped_ptr<AutofillExternalDelegate> autofill_external_delegate_; | |
| 30 }; | |
| 31 | |
| 32 IN_PROC_BROWSER_TEST_F(AutofillExternalDelegateViewsBrowserTest, | |
| 33 OpenAndClosePopup) { | |
| 34 int query_id = 1; | |
| 35 webkit::forms::FormData form; | |
| 36 webkit::forms::FormField field; | |
| 37 field.is_focusable = true; | |
| 38 field.should_autocomplete = true; | |
| 39 gfx::Rect bounds(100, 100); | |
| 40 | |
| 41 // Ensure that we can populate the popup through the delegate without any | |
| 42 // and then close it. | |
| 43 autofill_external_delegate_->OnQuery(query_id, form, field, bounds, false); | |
| 44 | |
| 45 std::vector<string16> autofill_item; | |
| 46 autofill_item.push_back(string16()); | |
| 47 std::vector<int> autofill_id; | |
| 48 autofill_id.push_back(0); | |
| 49 autofill_external_delegate_->OnSuggestionsReturned( | |
| 50 query_id, autofill_item, autofill_item, autofill_item, autofill_id); | |
| 51 | |
| 52 autofill_external_delegate_->HideAutofillPopup(); | |
| 53 } | |
| OLD | NEW |