OLD | NEW |
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 | 4 |
| 5 #include "android_webview/browser/aw_form_database_service.h" |
| 6 |
| 7 #include <memory> |
5 #include <vector> | 8 #include <vector> |
6 | 9 |
7 #include "android_webview/browser/aw_form_database_service.h" | |
8 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
9 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 14 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
14 #include "components/autofill/core/common/form_field_data.h" | 15 #include "components/autofill/core/common/form_field_data.h" |
15 #include "content/public/test/test_browser_thread.h" | 16 #include "content/public/test/test_browser_thread.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "ui/base/l10n/l10n_util_android.h" | 18 #include "ui/base/l10n/l10n_util_android.h" |
18 | 19 |
19 using autofill::AutofillWebDataService; | 20 using autofill::AutofillWebDataService; |
20 using autofill::FormFieldData; | 21 using autofill::FormFieldData; |
(...skipping 24 matching lines...) Expand all Loading... |
45 void TearDown() override { service_->Shutdown(); } | 46 void TearDown() override { service_->Shutdown(); } |
46 | 47 |
47 // The path to the temporary directory used for the test operations. | 48 // The path to the temporary directory used for the test operations. |
48 base::ScopedTempDir temp_dir_; | 49 base::ScopedTempDir temp_dir_; |
49 // A message loop for UI thread. | 50 // A message loop for UI thread. |
50 base::MessageLoop message_loop_; | 51 base::MessageLoop message_loop_; |
51 content::TestBrowserThread ui_thread_; | 52 content::TestBrowserThread ui_thread_; |
52 content::TestBrowserThread db_thread_; | 53 content::TestBrowserThread db_thread_; |
53 JNIEnv* env_; | 54 JNIEnv* env_; |
54 | 55 |
55 scoped_ptr<AwFormDatabaseService> service_; | 56 std::unique_ptr<AwFormDatabaseService> service_; |
56 }; | 57 }; |
57 | 58 |
58 // Disabling this test until we know why it crashes. | 59 // Disabling this test until we know why it crashes. |
59 // TODO(sgurun): See http://crbug.com/287726 for details. | 60 // TODO(sgurun): See http://crbug.com/287726 for details. |
60 TEST_F(AwFormDatabaseServiceTest, DISABLED_HasAndClearFormData) { | 61 TEST_F(AwFormDatabaseServiceTest, DISABLED_HasAndClearFormData) { |
61 EXPECT_FALSE(service_->HasFormData()); | 62 EXPECT_FALSE(service_->HasFormData()); |
62 std::vector<FormFieldData> fields; | 63 std::vector<FormFieldData> fields; |
63 FormFieldData field; | 64 FormFieldData field; |
64 field.name = base::ASCIIToUTF16("foo"); | 65 field.name = base::ASCIIToUTF16("foo"); |
65 field.value = base::ASCIIToUTF16("bar"); | 66 field.value = base::ASCIIToUTF16("bar"); |
66 fields.push_back(field); | 67 fields.push_back(field); |
67 service_->get_autofill_webdata_service()->AddFormFields(fields); | 68 service_->get_autofill_webdata_service()->AddFormFields(fields); |
68 EXPECT_TRUE(service_->HasFormData()); | 69 EXPECT_TRUE(service_->HasFormData()); |
69 service_->ClearFormData(); | 70 service_->ClearFormData(); |
70 EXPECT_FALSE(service_->HasFormData()); | 71 EXPECT_FALSE(service_->HasFormData()); |
71 } | 72 } |
72 | 73 |
73 } // namespace android_webview | 74 } // namespace android_webview |
OLD | NEW |