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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa_browsertest.mm

Issue 16025002: Fix AutofillDialogCocoaBrowserTest.DisplayUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #import "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h" 4 #import "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h"
5 5
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" 9 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" 11 #include "chrome/browser/ui/tabs/tab_strip_model.h"
12 #include "chrome/test/base/in_process_browser_test.h" 12 #include "chrome/test/base/in_process_browser_test.h"
13 #include "components/autofill/browser/autofill_common_test.h"
13 #include "components/autofill/common/form_data.h" 14 #include "components/autofill/common/form_data.h"
14 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
15 #include "content/public/browser/web_contents_view.h" 16 #include "content/public/browser/web_contents_view.h"
16 #include "content/public/test/test_utils.h" 17 #include "content/public/test/test_utils.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
20 // TODO(groby): This entire file can be removed once the dialog supports the
21 // cross-platform tests at AutofillDialogControllerTest.*
22
19 namespace autofill { 23 namespace autofill {
20 24
21 namespace { 25 namespace {
22 26
23 void MockCallback(const FormStructure*, const std::string&) {} 27 void MockCallback(const FormStructure*, const std::string&) {}
24 28
25 class TestAutofillDialogController : public AutofillDialogControllerImpl { 29 class TestAutofillDialogController : public AutofillDialogControllerImpl {
26 public: 30 public:
27 TestAutofillDialogController( 31 TestAutofillDialogController(
28 content::WebContents* contents, 32 content::WebContents* contents,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 DISALLOW_COPY_AND_ASSIGN(TestAutofillDialogController); 74 DISALLOW_COPY_AND_ASSIGN(TestAutofillDialogController);
71 }; 75 };
72 76
73 class AutofillDialogCocoaBrowserTest : public InProcessBrowserTest { 77 class AutofillDialogCocoaBrowserTest : public InProcessBrowserTest {
74 public: 78 public:
75 AutofillDialogCocoaBrowserTest() : InProcessBrowserTest() {} 79 AutofillDialogCocoaBrowserTest() : InProcessBrowserTest() {}
76 80
77 virtual ~AutofillDialogCocoaBrowserTest() {} 81 virtual ~AutofillDialogCocoaBrowserTest() {}
78 82
79 virtual void SetUpOnMainThread() OVERRIDE { 83 virtual void SetUpOnMainThread() OVERRIDE {
84 // Ensure Mac OS X does not pop up a modal dialog for the Address Book.
85 autofill::test::DisableSystemServices(browser()->profile());
Avi (use Gerrit) 2013/05/24 16:21:24 Passing a real profile here, rather than NULL as y
86
80 FormFieldData field; 87 FormFieldData field;
81 field.autocomplete_attribute = "cc-number"; 88 field.autocomplete_attribute = "cc-number";
82 FormData form_data; 89 FormData form_data;
83 form_data.fields.push_back(field); 90 form_data.fields.push_back(field);
84 runner_ = new content::MessageLoopRunner; 91 runner_ = new content::MessageLoopRunner;
85 controller_ = new TestAutofillDialogController( 92 controller_ = new TestAutofillDialogController(
86 browser()->tab_strip_model()->GetActiveWebContents(), 93 browser()->tab_strip_model()->GetActiveWebContents(),
87 form_data, 94 form_data,
88 metric_logger_, 95 metric_logger_,
89 runner_, 96 runner_,
90 DIALOG_TYPE_REQUEST_AUTOCOMPLETE); 97 DIALOG_TYPE_REQUEST_AUTOCOMPLETE);
91 } 98 }
92 99
93 TestAutofillDialogController* controller() { return controller_; } 100 TestAutofillDialogController* controller() { return controller_; }
94 101
95 private: 102 private:
96 // The controller owns itself. 103 // The controller owns itself.
97 TestAutofillDialogController* controller_; 104 TestAutofillDialogController* controller_;
98 105
99 // The following members must outlive the controller. 106 // The following members must outlive the controller.
100 AutofillMetrics metric_logger_; 107 AutofillMetrics metric_logger_;
101 scoped_refptr<content::MessageLoopRunner> runner_; 108 scoped_refptr<content::MessageLoopRunner> runner_;
102 109
103 DISALLOW_COPY_AND_ASSIGN(AutofillDialogCocoaBrowserTest); 110 DISALLOW_COPY_AND_ASSIGN(AutofillDialogCocoaBrowserTest);
104 }; 111 };
105 112
106 // The following test fails under ASAN. Disabling until root cause is found. 113 IN_PROC_BROWSER_TEST_F(AutofillDialogCocoaBrowserTest, DisplayUI) {
107 // This can pop up a "browser_tests would like access to your Contacts" dialog.
108 // See also http://crbug.com/234008.
109 #if defined(ADDRESS_SANITIZER)
110 #define MAYBE_DisplayUI DISABLED_DisplayUI
111 #else
112 #define MAYBE_DisplayUI DisplayUI
113 #endif
114 IN_PROC_BROWSER_TEST_F(AutofillDialogCocoaBrowserTest, MAYBE_DisplayUI) {
115 controller()->Show(); 114 controller()->Show();
116 controller()->OnCancel(); 115 controller()->OnCancel();
117 controller()->Hide(); 116 controller()->Hide();
118 117
119 controller()->RunMessageLoop(); 118 controller()->RunMessageLoop();
120 } 119 }
121 120
122 } // namespace 121 } // namespace
123 122
124 } // namespace autofill 123 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698