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

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

Issue 13996022: [Autofill] Fix test breakage under ASAN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 DISALLOW_COPY_AND_ASSIGN(TestAutofillDialogController); 72 DISALLOW_COPY_AND_ASSIGN(TestAutofillDialogController);
69 }; 73 };
70 74
71 class AutofillDialogCocoaBrowserTest : public InProcessBrowserTest { 75 class AutofillDialogCocoaBrowserTest : public InProcessBrowserTest {
72 public: 76 public:
73 AutofillDialogCocoaBrowserTest() : InProcessBrowserTest() {} 77 AutofillDialogCocoaBrowserTest() : InProcessBrowserTest() {}
74 78
75 virtual ~AutofillDialogCocoaBrowserTest() {} 79 virtual ~AutofillDialogCocoaBrowserTest() {}
76 80
77 virtual void SetUpOnMainThread() OVERRIDE { 81 virtual void SetUpOnMainThread() OVERRIDE {
82 // Ensure OSX does not pop up a modal dialog for Address Book.
83 autofill::test::DisableSystemServices(NULL);
84
78 FormFieldData field; 85 FormFieldData field;
79 field.autocomplete_attribute = "cc-number"; 86 field.autocomplete_attribute = "cc-number";
80 FormData form_data; 87 FormData form_data;
81 form_data.fields.push_back(field); 88 form_data.fields.push_back(field);
82 runner_ = new content::MessageLoopRunner; 89 runner_ = new content::MessageLoopRunner;
83 controller_ = new TestAutofillDialogController( 90 controller_ = new TestAutofillDialogController(
84 browser()->tab_strip_model()->GetActiveWebContents(), 91 browser()->tab_strip_model()->GetActiveWebContents(),
85 form_data, 92 form_data,
86 metric_logger_, 93 metric_logger_,
87 runner_, 94 runner_,
88 DIALOG_TYPE_REQUEST_AUTOCOMPLETE); 95 DIALOG_TYPE_REQUEST_AUTOCOMPLETE);
89 } 96 }
90 97
91 TestAutofillDialogController* controller() { return controller_; } 98 TestAutofillDialogController* controller() { return controller_; }
92 99
93 private: 100 private:
94 // The controller owns itself. 101 // The controller owns itself.
95 TestAutofillDialogController* controller_; 102 TestAutofillDialogController* controller_;
96 103
97 // The following members must outlive the controller. 104 // The following members must outlive the controller.
98 AutofillMetrics metric_logger_; 105 AutofillMetrics metric_logger_;
99 scoped_refptr<content::MessageLoopRunner> runner_; 106 scoped_refptr<content::MessageLoopRunner> runner_;
100 107
101 DISALLOW_COPY_AND_ASSIGN(AutofillDialogCocoaBrowserTest); 108 DISALLOW_COPY_AND_ASSIGN(AutofillDialogCocoaBrowserTest);
102 }; 109 };
103 110
104 // The following test fails under ASAN. Disabling until root cause is found. 111 IN_PROC_BROWSER_TEST_F(AutofillDialogCocoaBrowserTest, DisplayUI) {
105 // This can pop up a "browser_tests would like access to your Contacts" dialog.
106 // See also http://crbug.com/234008.
107 #if defined(ADDRESS_SANITIZER)
108 #define MAYBE_DisplayUI DISABLED_DisplayUI
109 #else
110 #define MAYBE_DisplayUI DisplayUI
111 #endif
112 IN_PROC_BROWSER_TEST_F(AutofillDialogCocoaBrowserTest, MAYBE_DisplayUI) {
113 controller()->Show(); 112 controller()->Show();
114 controller()->view()->CancelForTesting(); 113 controller()->view()->CancelForTesting();
115 114
116 controller()->RunMessageLoop(); 115 controller()->RunMessageLoop();
117 } 116 }
118 117
119 } // namespace 118 } // namespace
120 119
121 } // namespace autofill 120 } // 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