OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <algorithm> | 5 #include <algorithm> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 virtual MockAutofillManager* mock_autofill_manager() { | 59 virtual MockAutofillManager* mock_autofill_manager() { |
60 return static_cast<MockAutofillManager*>(autofill_manager()); | 60 return static_cast<MockAutofillManager*>(autofill_manager()); |
61 } | 61 } |
62 | 62 |
63 using ContentAutofillDriver::DidNavigateMainFrame; | 63 using ContentAutofillDriver::DidNavigateMainFrame; |
64 }; | 64 }; |
65 | 65 |
66 class ContentAutofillDriverTest : public content::RenderViewHostTestHarness { | 66 class ContentAutofillDriverTest : public content::RenderViewHostTestHarness { |
67 public: | 67 public: |
68 virtual void SetUp() OVERRIDE { | 68 virtual void SetUp() override { |
69 content::RenderViewHostTestHarness::SetUp(); | 69 content::RenderViewHostTestHarness::SetUp(); |
70 | 70 |
71 test_autofill_client_.reset(new TestAutofillClient()); | 71 test_autofill_client_.reset(new TestAutofillClient()); |
72 driver_.reset(new TestContentAutofillDriver(web_contents(), | 72 driver_.reset(new TestContentAutofillDriver(web_contents(), |
73 test_autofill_client_.get())); | 73 test_autofill_client_.get())); |
74 } | 74 } |
75 | 75 |
76 virtual void TearDown() OVERRIDE { | 76 virtual void TearDown() override { |
77 // Reset the driver now to cause all pref observers to be removed and avoid | 77 // Reset the driver now to cause all pref observers to be removed and avoid |
78 // crashes that otherwise occur in the destructor. | 78 // crashes that otherwise occur in the destructor. |
79 driver_.reset(); | 79 driver_.reset(); |
80 content::RenderViewHostTestHarness::TearDown(); | 80 content::RenderViewHostTestHarness::TearDown(); |
81 } | 81 } |
82 | 82 |
83 protected: | 83 protected: |
84 // Searches for an |AutofillMsg_FillForm| message in the queue of sent IPC | 84 // Searches for an |AutofillMsg_FillForm| message in the queue of sent IPC |
85 // messages. If none is present, returns false. Otherwise, extracts the first | 85 // messages. If none is present, returns false. Otherwise, extracts the first |
86 // |AutofillMsg_FillForm| message, fills the output parameters with the values | 86 // |AutofillMsg_FillForm| message, fills the output parameters with the values |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 base::string16 input_value(base::ASCIIToUTF16("barqux")); | 314 base::string16 input_value(base::ASCIIToUTF16("barqux")); |
315 base::string16 output_value; | 315 base::string16 output_value; |
316 driver_->RendererShouldPreviewFieldWithValue(input_value); | 316 driver_->RendererShouldPreviewFieldWithValue(input_value); |
317 EXPECT_TRUE(GetString16FromMessageWithID( | 317 EXPECT_TRUE(GetString16FromMessageWithID( |
318 AutofillMsg_PreviewFieldWithValue::ID, | 318 AutofillMsg_PreviewFieldWithValue::ID, |
319 &output_value)); | 319 &output_value)); |
320 EXPECT_EQ(input_value, output_value); | 320 EXPECT_EQ(input_value, output_value); |
321 } | 321 } |
322 | 322 |
323 } // namespace autofill | 323 } // namespace autofill |
OLD | NEW |