summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-19 23:51:04 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-19 23:51:04 +0000
commit0faac1d9b905b77b439e563b5b144267f9c77839 (patch)
tree386ece3cf4eda990c6556cc73ad3c659c9f27352
parent4220210df8cacf45b93d913059aed3704bb27287 (diff)
downloadchromium_src-0faac1d9b905b77b439e563b5b144267f9c77839.zip
chromium_src-0faac1d9b905b77b439e563b5b144267f9c77839.tar.gz
chromium_src-0faac1d9b905b77b439e563b5b144267f9c77839.tar.bz2
Moving Autofill-related test support files out of chrome_tests_unit.gypi.
Mostly this is just a mechanical modification of .gypi files. For one class, DataDrivenTest, a dependency on chrome/common/chrome_paths.h needed to be broken. BUG=254754 Review URL: https://chromiumcodereview.appspot.com/19578005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212697 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autofill/form_structure_browsertest.cc12
-rw-r--r--chrome/chrome_tests.gypi2
-rw-r--r--chrome/chrome_tests_unit.gypi21
-rw-r--r--components/autofill.gypi28
-rw-r--r--components/autofill/core/browser/autofill_merge_unittest.cc14
-rw-r--r--components/autofill/core/browser/data_driven_test.cc31
-rw-r--r--components/autofill/core/browser/data_driven_test.h4
-rw-r--r--components/test/data/autofill/merge/input/ambiguous.in (renamed from chrome/test/data/autofill/merge/input/ambiguous.in)0
-rw-r--r--components/test/data/autofill/merge/input/case.in (renamed from chrome/test/data/autofill/merge/input/case.in)0
-rw-r--r--components/test/data/autofill/merge/input/email.in (renamed from chrome/test/data/autofill/merge/input/email.in)0
-rw-r--r--components/test/data/autofill/merge/input/identical.in (renamed from chrome/test/data/autofill/merge/input/identical.in)0
-rw-r--r--components/test/data/autofill/merge/input/multimerge.in (renamed from chrome/test/data/autofill/merge/input/multimerge.in)0
-rw-r--r--components/test/data/autofill/merge/input/primarycase.in (renamed from chrome/test/data/autofill/merge/input/primarycase.in)0
-rw-r--r--components/test/data/autofill/merge/input/singlemerge.in (renamed from chrome/test/data/autofill/merge/input/singlemerge.in)0
-rw-r--r--components/test/data/autofill/merge/input/validation.in (renamed from chrome/test/data/autofill/merge/input/validation.in)0
-rw-r--r--components/test/data/autofill/merge/output/ambiguous.out (renamed from chrome/test/data/autofill/merge/output/ambiguous.out)0
-rw-r--r--components/test/data/autofill/merge/output/case.out (renamed from chrome/test/data/autofill/merge/output/case.out)0
-rw-r--r--components/test/data/autofill/merge/output/email.out (renamed from chrome/test/data/autofill/merge/output/email.out)0
-rw-r--r--components/test/data/autofill/merge/output/identical.out (renamed from chrome/test/data/autofill/merge/output/identical.out)0
-rw-r--r--components/test/data/autofill/merge/output/multimerge.out (renamed from chrome/test/data/autofill/merge/output/multimerge.out)0
-rw-r--r--components/test/data/autofill/merge/output/primarycase.out (renamed from chrome/test/data/autofill/merge/output/primarycase.out)0
-rw-r--r--components/test/data/autofill/merge/output/singlemerge.out (renamed from chrome/test/data/autofill/merge/output/singlemerge.out)0
-rw-r--r--components/test/data/autofill/merge/output/validation.out (renamed from chrome/test/data/autofill/merge/output/validation.out)0
-rw-r--r--components/test/data/autofill/merge/tools/autofill_merge_common.py (renamed from chrome/test/data/autofill/merge/tools/autofill_merge_common.py)2
-rwxr-xr-xcomponents/test/data/autofill/merge/tools/flatten.py (renamed from chrome/test/data/autofill/merge/tools/flatten.py)2
-rwxr-xr-xcomponents/test/data/autofill/merge/tools/reserialize_profiles_from_query.py (renamed from chrome/test/data/autofill/merge/tools/reserialize_profiles_from_query.py)2
-rwxr-xr-xcomponents/test/data/autofill/merge/tools/serialize_profiles.py (renamed from chrome/test/data/autofill/merge/tools/serialize_profiles.py)2
27 files changed, 76 insertions, 44 deletions
diff --git a/chrome/browser/autofill/form_structure_browsertest.cc b/chrome/browser/autofill/form_structure_browsertest.cc
index e6babac..0666fa2 100644
--- a/chrome/browser/autofill/form_structure_browsertest.cc
+++ b/chrome/browser/autofill/form_structure_browsertest.cc
@@ -5,10 +5,12 @@
#include <vector>
#include "base/files/file_path.h"
+#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/autofill/content/browser/autofill_driver_impl.h"
@@ -27,6 +29,13 @@ GURL HTMLToDataURI(const std::string& html) {
return GURL(std::string("data:text/html;charset=utf-8,") + html);
}
+const base::FilePath& GetTestDataDir() {
+ CR_DEFINE_STATIC_LOCAL(base::FilePath, dir, ());
+ if (dir.empty())
+ PathService::Get(chrome::DIR_TEST_DATA, &dir);
+ return dir;
+}
+
} // namespace
// A data-driven test for verifying Autofill heuristics. Each input is an HTML
@@ -49,7 +58,8 @@ class FormStructureBrowserTest : public InProcessBrowserTest,
DISALLOW_COPY_AND_ASSIGN(FormStructureBrowserTest);
};
-FormStructureBrowserTest::FormStructureBrowserTest() {
+FormStructureBrowserTest::FormStructureBrowserTest()
+ : DataDrivenTest(GetTestDataDir()) {
}
FormStructureBrowserTest::~FormStructureBrowserTest() {
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 26292c5..e157162 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1125,7 +1125,7 @@
'../base/base.gyp:base_i18n',
'../base/base.gyp:test_support_base',
'../components/components.gyp:autofill_content_risk_proto',
- '../components/components.gyp:autofill_content_test_util',
+ '../components/components.gyp:autofill_content_test_support',
'../device/bluetooth/bluetooth.gyp:device_bluetooth_mocks',
'../net/net.gyp:net',
'../net/net.gyp:net_test_support',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 31ac60b..976479c 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -272,24 +272,6 @@
'test/logging/win/test_log_collector.h',
'test/ppapi/ppapi_test.cc',
'test/ppapi/ppapi_test.h',
-
- # TODO(joi): Move to //components/components.gypi once
- # remaining dependencies back to //chrome are eliminated.
- '../components/autofill/core/browser/android/test_auxiliary_profile_loader_android.cc',
- '../components/autofill/core/browser/android/test_auxiliary_profile_loader_android.h',
- '../components/autofill/core/browser/autofill_common_test.cc',
- '../components/autofill/core/browser/autofill_common_test.h',
- '../components/autofill/core/browser/data_driven_test.cc',
- '../components/autofill/core/browser/data_driven_test.h',
- '../components/autofill/core/browser/test_autofill_driver.cc',
- '../components/autofill/core/browser/test_autofill_driver.h',
- '../components/autofill/core/browser/test_autofill_external_delegate.cc',
- '../components/autofill/core/browser/test_autofill_external_delegate.h',
- '../components/autofill/core/browser/test_autofill_manager_delegate.cc',
- '../components/autofill/core/browser/test_autofill_manager_delegate.h',
- '../components/autofill/core/browser/test_personal_data_manager.cc',
- '../components/autofill/core/browser/test_personal_data_manager.h',
-
'../ui/gfx/image/image_unittest_util.h',
'../ui/gfx/image/image_unittest_util.cc',
'../webkit/browser/quota/mock_quota_manager.cc',
@@ -309,6 +291,7 @@
'../content/content.gyp:content_renderer',
'../content/content.gyp:content_utility',
'../content/content.gyp:content_worker',
+ '../components/components.gyp:autofill_core_test_support',
'../ipc/ipc.gyp:test_support_ipc',
'../ppapi/ppapi_internal.gyp:ppapi_shared',
'../third_party/leveldatabase/leveldatabase.gyp:leveldatabase',
@@ -1913,7 +1896,7 @@
['OS!="ios"', {
'dependencies': [
'common/extensions/api/api.gyp:api',
- '../components/components.gyp:autofill_content_test_util',
+ '../components/components.gyp:autofill_content_test_support',
'../components/component_strings.gyp:component_strings',
'../device/bluetooth/bluetooth.gyp:device_bluetooth_mocks',
'../gpu/gpu.gyp:gpu_unittest_utils',
diff --git a/components/autofill.gypi b/components/autofill.gypi
index c956e33..adad8ec 100644
--- a/components/autofill.gypi
+++ b/components/autofill.gypi
@@ -215,6 +215,32 @@
},
{
+ 'target_name': 'autofill_core_test_support',
+ 'type': 'static_library',
+ 'dependencies': [
+ 'autofill_core_common',
+ 'autofill_core_browser',
+ '../testing/gtest.gyp:gtest',
+ ],
+ 'sources': [
+ 'autofill/core/browser/android/test_auxiliary_profile_loader_android.cc',
+ 'autofill/core/browser/android/test_auxiliary_profile_loader_android.h',
+ 'autofill/core/browser/autofill_common_test.cc',
+ 'autofill/core/browser/autofill_common_test.h',
+ 'autofill/core/browser/data_driven_test.cc',
+ 'autofill/core/browser/data_driven_test.h',
+ 'autofill/core/browser/test_autofill_driver.cc',
+ 'autofill/core/browser/test_autofill_driver.h',
+ 'autofill/core/browser/test_autofill_external_delegate.cc',
+ 'autofill/core/browser/test_autofill_external_delegate.h',
+ 'autofill/core/browser/test_autofill_manager_delegate.cc',
+ 'autofill/core/browser/test_autofill_manager_delegate.h',
+ 'autofill/core/browser/test_personal_data_manager.cc',
+ 'autofill/core/browser/test_personal_data_manager.h',
+ ],
+ },
+
+ {
# Protobuf compiler / generate rule for Autofill's risk integration.
'target_name': 'autofill_content_risk_proto',
'type': 'static_library',
@@ -228,7 +254,7 @@
'includes': [ '../build/protoc.gypi' ]
},
{
- 'target_name': 'autofill_content_test_util',
+ 'target_name': 'autofill_content_test_support',
'type': 'static_library',
'dependencies': [
'../testing/gmock.gyp:gmock',
diff --git a/components/autofill/core/browser/autofill_merge_unittest.cc b/components/autofill/core/browser/autofill_merge_unittest.cc
index b83d703..39951ab 100644
--- a/components/autofill/core/browser/autofill_merge_unittest.cc
+++ b/components/autofill/core/browser/autofill_merge_unittest.cc
@@ -6,6 +6,7 @@
#include "base/basictypes.h"
#include "base/files/file_path.h"
+#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/autofill_common_test.h"
@@ -44,6 +45,17 @@ const AutofillFieldType kProfileFieldTypes[] = {
PHONE_HOME_WHOLE_NUMBER
};
+const base::FilePath& GetTestDataDir() {
+ CR_DEFINE_STATIC_LOCAL(base::FilePath, dir, ());
+ if (dir.empty()) {
+ PathService::Get(base::DIR_SOURCE_ROOT, &dir);
+ dir = dir.AppendASCII("components");
+ dir = dir.AppendASCII("test");
+ dir = dir.AppendASCII("data");
+ }
+ return dir;
+}
+
// Serializes the |profiles| into a string.
std::string SerializeProfiles(const std::vector<AutofillProfile*>& profiles) {
std::string result;
@@ -137,7 +149,7 @@ class AutofillMergeTest : public testing::Test,
DISALLOW_COPY_AND_ASSIGN(AutofillMergeTest);
};
-AutofillMergeTest::AutofillMergeTest() : DataDrivenTest() {
+AutofillMergeTest::AutofillMergeTest() : DataDrivenTest(GetTestDataDir()) {
}
AutofillMergeTest::~AutofillMergeTest() {
diff --git a/components/autofill/core/browser/data_driven_test.cc b/components/autofill/core/browser/data_driven_test.cc
index 18c0adb..18f461e 100644
--- a/components/autofill/core/browser/data_driven_test.cc
+++ b/components/autofill/core/browser/data_driven_test.cc
@@ -6,9 +6,7 @@
#include "base/file_util.h"
#include "base/files/file_enumerator.h"
-#include "base/path_service.h"
#include "base/strings/string_util.h"
-#include "chrome/common/chrome_paths.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace autofill {
@@ -27,7 +25,7 @@ bool ReadFile(const base::FilePath& file, std::string* content) {
// Write |content| to |file|. Returns true on success.
bool WriteFile(const base::FilePath& file, const std::string& content) {
int write_size = file_util::WriteFile(file, content.c_str(),
- content.length());
+ static_cast<int>(content.length()));
return write_size == static_cast<int>(content.length());
}
@@ -37,6 +35,8 @@ void DataDrivenTest::RunDataDrivenTest(
const base::FilePath& input_directory,
const base::FilePath& output_directory,
const base::FilePath::StringType& file_name_pattern) {
+ ASSERT_TRUE(base::DirectoryExists(input_directory));
+ ASSERT_TRUE(base::DirectoryExists(output_directory));
base::FileEnumerator input_files(input_directory,
false,
base::FileEnumerator::FILES,
@@ -67,25 +67,24 @@ void DataDrivenTest::RunDataDrivenTest(
base::FilePath DataDrivenTest::GetInputDirectory(
const base::FilePath::StringType& test_name) {
- base::FilePath test_data_dir_;
- PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_);
- test_data_dir_ = test_data_dir_.AppendASCII("autofill")
- .Append(test_name)
- .AppendASCII("input");
- return test_data_dir_;
+ base::FilePath dir;
+ dir = test_data_directory_.AppendASCII("autofill")
+ .Append(test_name)
+ .AppendASCII("input");
+ return dir;
}
base::FilePath DataDrivenTest::GetOutputDirectory(
const base::FilePath::StringType& test_name) {
- base::FilePath test_data_dir_;
- PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_);
- test_data_dir_ = test_data_dir_.AppendASCII("autofill")
- .Append(test_name)
- .AppendASCII("output");
- return test_data_dir_;
+ base::FilePath dir;
+ dir = test_data_directory_.AppendASCII("autofill")
+ .Append(test_name)
+ .AppendASCII("output");
+ return dir;
}
-DataDrivenTest::DataDrivenTest() {
+DataDrivenTest::DataDrivenTest(const base::FilePath& test_data_directory)
+ : test_data_directory_(test_data_directory) {
}
DataDrivenTest::~DataDrivenTest() {
diff --git a/components/autofill/core/browser/data_driven_test.h b/components/autofill/core/browser/data_driven_test.h
index 4cbb5a0..aff2f31 100644
--- a/components/autofill/core/browser/data_driven_test.h
+++ b/components/autofill/core/browser/data_driven_test.h
@@ -42,10 +42,12 @@ class DataDrivenTest {
const base::FilePath::StringType& test_name);
protected:
- DataDrivenTest();
+ DataDrivenTest(const base::FilePath& test_data_directory);
virtual ~DataDrivenTest();
private:
+ base::FilePath test_data_directory_;
+
DISALLOW_COPY_AND_ASSIGN(DataDrivenTest);
};
diff --git a/chrome/test/data/autofill/merge/input/ambiguous.in b/components/test/data/autofill/merge/input/ambiguous.in
index 3c55a6a..3c55a6a 100644
--- a/chrome/test/data/autofill/merge/input/ambiguous.in
+++ b/components/test/data/autofill/merge/input/ambiguous.in
diff --git a/chrome/test/data/autofill/merge/input/case.in b/components/test/data/autofill/merge/input/case.in
index 4657046..4657046 100644
--- a/chrome/test/data/autofill/merge/input/case.in
+++ b/components/test/data/autofill/merge/input/case.in
diff --git a/chrome/test/data/autofill/merge/input/email.in b/components/test/data/autofill/merge/input/email.in
index c970da0..c970da0 100644
--- a/chrome/test/data/autofill/merge/input/email.in
+++ b/components/test/data/autofill/merge/input/email.in
diff --git a/chrome/test/data/autofill/merge/input/identical.in b/components/test/data/autofill/merge/input/identical.in
index ff34555..ff34555 100644
--- a/chrome/test/data/autofill/merge/input/identical.in
+++ b/components/test/data/autofill/merge/input/identical.in
diff --git a/chrome/test/data/autofill/merge/input/multimerge.in b/components/test/data/autofill/merge/input/multimerge.in
index 5e4ef80..5e4ef80 100644
--- a/chrome/test/data/autofill/merge/input/multimerge.in
+++ b/components/test/data/autofill/merge/input/multimerge.in
diff --git a/chrome/test/data/autofill/merge/input/primarycase.in b/components/test/data/autofill/merge/input/primarycase.in
index 5e56fa3..5e56fa3 100644
--- a/chrome/test/data/autofill/merge/input/primarycase.in
+++ b/components/test/data/autofill/merge/input/primarycase.in
diff --git a/chrome/test/data/autofill/merge/input/singlemerge.in b/components/test/data/autofill/merge/input/singlemerge.in
index 4e208ab..4e208ab 100644
--- a/chrome/test/data/autofill/merge/input/singlemerge.in
+++ b/components/test/data/autofill/merge/input/singlemerge.in
diff --git a/chrome/test/data/autofill/merge/input/validation.in b/components/test/data/autofill/merge/input/validation.in
index 634f23f..634f23f 100644
--- a/chrome/test/data/autofill/merge/input/validation.in
+++ b/components/test/data/autofill/merge/input/validation.in
diff --git a/chrome/test/data/autofill/merge/output/ambiguous.out b/components/test/data/autofill/merge/output/ambiguous.out
index e69de29..e69de29 100644
--- a/chrome/test/data/autofill/merge/output/ambiguous.out
+++ b/components/test/data/autofill/merge/output/ambiguous.out
diff --git a/chrome/test/data/autofill/merge/output/case.out b/components/test/data/autofill/merge/output/case.out
index 5b28e19..5b28e19 100644
--- a/chrome/test/data/autofill/merge/output/case.out
+++ b/components/test/data/autofill/merge/output/case.out
diff --git a/chrome/test/data/autofill/merge/output/email.out b/components/test/data/autofill/merge/output/email.out
index e69de29..e69de29 100644
--- a/chrome/test/data/autofill/merge/output/email.out
+++ b/components/test/data/autofill/merge/output/email.out
diff --git a/chrome/test/data/autofill/merge/output/identical.out b/components/test/data/autofill/merge/output/identical.out
index 5b28e19..5b28e19 100644
--- a/chrome/test/data/autofill/merge/output/identical.out
+++ b/components/test/data/autofill/merge/output/identical.out
diff --git a/chrome/test/data/autofill/merge/output/multimerge.out b/components/test/data/autofill/merge/output/multimerge.out
index ecefee1..ecefee1 100644
--- a/chrome/test/data/autofill/merge/output/multimerge.out
+++ b/components/test/data/autofill/merge/output/multimerge.out
diff --git a/chrome/test/data/autofill/merge/output/primarycase.out b/components/test/data/autofill/merge/output/primarycase.out
index ecefee1..ecefee1 100644
--- a/chrome/test/data/autofill/merge/output/primarycase.out
+++ b/components/test/data/autofill/merge/output/primarycase.out
diff --git a/chrome/test/data/autofill/merge/output/singlemerge.out b/components/test/data/autofill/merge/output/singlemerge.out
index 76e4e25..76e4e25 100644
--- a/chrome/test/data/autofill/merge/output/singlemerge.out
+++ b/components/test/data/autofill/merge/output/singlemerge.out
diff --git a/chrome/test/data/autofill/merge/output/validation.out b/components/test/data/autofill/merge/output/validation.out
index 8f2df39..8f2df39 100644
--- a/chrome/test/data/autofill/merge/output/validation.out
+++ b/components/test/data/autofill/merge/output/validation.out
diff --git a/chrome/test/data/autofill/merge/tools/autofill_merge_common.py b/components/test/data/autofill/merge/tools/autofill_merge_common.py
index 3fc8b55..6a4a788 100644
--- a/chrome/test/data/autofill/merge/tools/autofill_merge_common.py
+++ b/components/test/data/autofill/merge/tools/autofill_merge_common.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chrome/test/data/autofill/merge/tools/flatten.py b/components/test/data/autofill/merge/tools/flatten.py
index 720329f..81a6690 100755
--- a/chrome/test/data/autofill/merge/tools/flatten.py
+++ b/components/test/data/autofill/merge/tools/flatten.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chrome/test/data/autofill/merge/tools/reserialize_profiles_from_query.py b/components/test/data/autofill/merge/tools/reserialize_profiles_from_query.py
index e57df85..99dc199 100755
--- a/chrome/test/data/autofill/merge/tools/reserialize_profiles_from_query.py
+++ b/components/test/data/autofill/merge/tools/reserialize_profiles_from_query.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chrome/test/data/autofill/merge/tools/serialize_profiles.py b/components/test/data/autofill/merge/tools/serialize_profiles.py
index ac0fa1c..18df1f2 100755
--- a/chrome/test/data/autofill/merge/tools/serialize_profiles.py
+++ b/components/test/data/autofill/merge/tools/serialize_profiles.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.