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

Side by Side Diff: chrome/renderer/autofill/autofill_renderer_browsertest.cc

Issue 232263002: Console logging for rAc developer errors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: platforms Created 6 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
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/test/base/chrome_render_view_test.h" 8 #include "chrome/test/base/chrome_render_view_test.h"
9 #include "components/autofill/content/common/autofill_messages.h" 9 #include "components/autofill/content/common/autofill_messages.h"
10 #include "components/autofill/content/renderer/autofill_agent.h" 10 #include "components/autofill/content/renderer/autofill_agent.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 TEST_F(RequestAutocompleteRendererTest, MainFrameNavigateCancels) { 273 TEST_F(RequestAutocompleteRendererTest, MainFrameNavigateCancels) {
274 // Pretend that the top-level frame navigated. A cancel should be sent. 274 // Pretend that the top-level frame navigated. A cancel should be sent.
275 NavigateFrame(GetMainFrame()); 275 NavigateFrame(GetMainFrame());
276 EXPECT_TRUE(render_thread_->sink().GetFirstMessageMatching( 276 EXPECT_TRUE(render_thread_->sink().GetFirstMessageMatching(
277 AutofillHostMsg_CancelRequestAutocomplete::ID)); 277 AutofillHostMsg_CancelRequestAutocomplete::ID));
278 } 278 }
279 279
280 TEST_F(RequestAutocompleteRendererTest, NoCancelOnSubframeNavigateAfterDone) { 280 TEST_F(RequestAutocompleteRendererTest, NoCancelOnSubframeNavigateAfterDone) {
281 // Pretend that the dialog was cancelled. 281 // Pretend that the dialog was cancelled.
282 autofill_agent_->OnRequestAutocompleteResult( 282 autofill_agent_->OnRequestAutocompleteResult(
283 WebFormElement::AutocompleteResultErrorCancel, FormData()); 283 WebFormElement::AutocompleteResultErrorCancel,
284 base::ASCIIToUTF16("Print me to the console"),
285 FormData());
284 286
285 // Additional navigations should not crash nor send cancels. 287 // Additional navigations should not crash nor send cancels.
286 NavigateFrame(invoking_frame()); 288 NavigateFrame(invoking_frame());
287 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( 289 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching(
288 AutofillHostMsg_CancelRequestAutocomplete::ID)); 290 AutofillHostMsg_CancelRequestAutocomplete::ID));
289 } 291 }
290 292
291 TEST_F(RequestAutocompleteRendererTest, NoCancelOnMainFrameNavigateAfterDone) { 293 TEST_F(RequestAutocompleteRendererTest, NoCancelOnMainFrameNavigateAfterDone) {
292 // Pretend that the dialog was cancelled. 294 // Pretend that the dialog was cancelled.
293 autofill_agent_->OnRequestAutocompleteResult( 295 autofill_agent_->OnRequestAutocompleteResult(
294 WebFormElement::AutocompleteResultErrorCancel, FormData()); 296 WebFormElement::AutocompleteResultErrorCancel,
297 base::ASCIIToUTF16("Print me to the console"),
298 FormData());
295 299
296 // Additional navigations should not crash nor send cancels. 300 // Additional navigations should not crash nor send cancels.
297 NavigateFrame(GetMainFrame()); 301 NavigateFrame(GetMainFrame());
298 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( 302 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching(
299 AutofillHostMsg_CancelRequestAutocomplete::ID)); 303 AutofillHostMsg_CancelRequestAutocomplete::ID));
300 } 304 }
301 305
302 TEST_F(RequestAutocompleteRendererTest, InvokingTwiceOnlyShowsOnce) { 306 TEST_F(RequestAutocompleteRendererTest, InvokingTwiceOnlyShowsOnce) {
303 // Attempting to show the requestAutocomplete dialog again should be ignored. 307 // Attempting to show the requestAutocomplete dialog again should be ignored.
304 autofill_agent_->didRequestAutocomplete(invoking_frame(), invoking_form()); 308 autofill_agent_->didRequestAutocomplete(invoking_frame(), invoking_form());
305 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( 309 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching(
306 AutofillHostMsg_RequestAutocomplete::ID)); 310 AutofillHostMsg_RequestAutocomplete::ID));
307 } 311 }
308 312
309 } // namespace autofill 313 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698