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

Side by Side Diff: chrome/browser/autofill/autofill_metrics_unittest.cc

Issue 10837363: Introduce AutofillClient and use it to get rid of PasswordManager dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix header Created 8 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 4
5 #include <vector> 5 #include <vector>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/api/infobars/infobar_tab_service.h" 11 #include "chrome/browser/api/infobars/infobar_tab_service.h"
12 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" 12 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
13 #include "chrome/browser/autofill/autofill_common_test.h" 13 #include "chrome/browser/autofill/autofill_common_test.h"
14 #include "chrome/browser/autofill/autofill_manager.h" 14 #include "chrome/browser/autofill/autofill_manager.h"
15 #include "chrome/browser/autofill/autofill_metrics.h" 15 #include "chrome/browser/autofill/autofill_metrics.h"
16 #include "chrome/browser/autofill/personal_data_manager.h" 16 #include "chrome/browser/autofill/personal_data_manager.h"
17 #include "chrome/browser/autofill/personal_data_manager_factory.h" 17 #include "chrome/browser/autofill/personal_data_manager_factory.h"
18 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents.h" 19 #include "chrome/browser/ui/tab_contents/tab_contents.h"
19 #include "chrome/browser/ui/tab_contents/test_tab_contents.h" 20 #include "chrome/browser/ui/tab_contents/test_tab_contents.h"
20 #include "chrome/browser/webdata/web_data_service.h" 21 #include "chrome/browser/webdata/web_data_service.h"
21 #include "chrome/test/base/testing_profile.h" 22 #include "chrome/test/base/testing_profile.h"
22 #include "content/public/test/test_browser_thread.h" 23 #include "content/public/test/test_browser_thread.h"
23 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
24 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
25 #include "ui/gfx/rect.h" 26 #include "ui/gfx/rect.h"
26 #include "webkit/forms/form_data.h" 27 #include "webkit/forms/form_data.h"
27 #include "webkit/forms/form_field.h" 28 #include "webkit/forms/form_field.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 168
168 private: 169 private:
169 std::string server_experiment_id_; 170 std::string server_experiment_id_;
170 DISALLOW_COPY_AND_ASSIGN(TestFormStructure); 171 DISALLOW_COPY_AND_ASSIGN(TestFormStructure);
171 }; 172 };
172 173
173 class TestAutofillManager : public AutofillManager { 174 class TestAutofillManager : public AutofillManager {
174 public: 175 public:
175 TestAutofillManager(TabContents* tab_contents, 176 TestAutofillManager(TabContents* tab_contents,
176 TestPersonalDataManager* personal_manager) 177 TestPersonalDataManager* personal_manager)
177 : AutofillManager(tab_contents, personal_manager), 178 : AutofillManager(&autofill_delegate_, tab_contents, personal_manager),
179 autofill_delegate_(tab_contents),
178 autofill_enabled_(true), 180 autofill_enabled_(true),
179 did_finish_async_form_submit_(false), 181 did_finish_async_form_submit_(false),
180 message_loop_is_running_(false) { 182 message_loop_is_running_(false) {
181 set_metric_logger(new MockAutofillMetrics); 183 set_metric_logger(new MockAutofillMetrics);
182 } 184 }
183 185
184 virtual bool IsAutofillEnabled() const { return autofill_enabled_; } 186 virtual bool IsAutofillEnabled() const { return autofill_enabled_; }
185 187
186 void set_autofill_enabled(bool autofill_enabled) { 188 void set_autofill_enabled(bool autofill_enabled) {
187 autofill_enabled_ = autofill_enabled; 189 autofill_enabled_ = autofill_enabled;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 AutofillManager::UploadFormDataAsyncCallback(submitted_form, 240 AutofillManager::UploadFormDataAsyncCallback(submitted_form,
239 load_time, 241 load_time,
240 interaction_time, 242 interaction_time,
241 submission_time); 243 submission_time);
242 } 244 }
243 245
244 private: 246 private:
245 // AutofillManager is ref counted. 247 // AutofillManager is ref counted.
246 virtual ~TestAutofillManager() {} 248 virtual ~TestAutofillManager() {}
247 249
250 TabAutofillManagerDelegate autofill_delegate_;
251
248 bool autofill_enabled_; 252 bool autofill_enabled_;
249 bool did_finish_async_form_submit_; 253 bool did_finish_async_form_submit_;
250 bool message_loop_is_running_; 254 bool message_loop_is_running_;
251 255
252 DISALLOW_COPY_AND_ASSIGN(TestAutofillManager); 256 DISALLOW_COPY_AND_ASSIGN(TestAutofillManager);
253 }; 257 };
254 258
255 } // namespace 259 } // namespace
256 260
257 class AutofillMetricsTest : public TabContentsTestHarness { 261 class AutofillMetricsTest : public TabContentsTestHarness {
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), 1466 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(),
1463 TimeTicks::FromInternalValue(3)); 1467 TimeTicks::FromInternalValue(3));
1464 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17)); 1468 autofill_manager_->FormSubmitted(form, TimeTicks::FromInternalValue(17));
1465 autofill_manager_->Reset(); 1469 autofill_manager_->Reset();
1466 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger()); 1470 Mock::VerifyAndClearExpectations(autofill_manager_->metric_logger());
1467 } 1471 }
1468 1472
1469 // Restore the global Gmock verbosity level to its default value. 1473 // Restore the global Gmock verbosity level to its default value.
1470 ::testing::FLAGS_gmock_verbose = "warning"; 1474 ::testing::FLAGS_gmock_verbose = "warning";
1471 } 1475 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_manager_unittest.cc ('k') | chrome/browser/plugin_infobar_delegates.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698