OLD | NEW |
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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/rand_util.h" | 7 #include "base/rand_util.h" |
8 #include "chrome/browser/webdata/autofill_table.h" | 8 #include "chrome/browser/webdata/autofill_table.h" |
9 #include "chrome/browser/webdata/web_database.h" | 9 #include "chrome/browser/webdata/web_database.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } // anonymous namespace | 95 } // anonymous namespace |
96 | 96 |
97 // Looks up |element_name| in the Chrome form data DB and ensures that the | 97 // Looks up |element_name| in the Chrome form data DB and ensures that the |
98 // results match |matcher|. | 98 // results match |matcher|. |
99 ACTION_P2(ExpectFormValuesForElementNameMatch, element_name, matcher) { | 99 ACTION_P2(ExpectFormValuesForElementNameMatch, element_name, matcher) { |
100 base::FilePath root_path; | 100 base::FilePath root_path; |
101 GetChromeFrameProfilePath(kIexploreProfileName, &root_path); | 101 GetChromeFrameProfilePath(kIexploreProfileName, &root_path); |
102 base::FilePath profile_path( | 102 base::FilePath profile_path( |
103 root_path.Append(L"Default").Append(chrome::kWebDataFilename)); | 103 root_path.Append(L"Default").Append(chrome::kWebDataFilename)); |
104 | 104 |
| 105 AutofillTable autofill_table; |
105 WebDatabase web_database; | 106 WebDatabase web_database; |
| 107 web_database.AddTable(&autofill_table); |
106 sql::InitStatus init_status = web_database.Init(profile_path, std::string()); | 108 sql::InitStatus init_status = web_database.Init(profile_path, std::string()); |
107 EXPECT_EQ(sql::INIT_OK, init_status); | 109 EXPECT_EQ(sql::INIT_OK, init_status); |
108 | 110 |
109 if (init_status == sql::INIT_OK) { | 111 if (init_status == sql::INIT_OK) { |
110 std::vector<string16> values; | 112 std::vector<string16> values; |
111 web_database.GetAutofillTable()->GetFormValuesForElementName( | 113 autofill_table.GetFormValuesForElementName( |
112 element_name, L"", &values, 9999); | 114 element_name, L"", &values, 9999); |
113 EXPECT_THAT(values, matcher); | 115 EXPECT_THAT(values, matcher); |
114 } | 116 } |
115 } | 117 } |
116 | 118 |
117 // Launch |ie_mock| and navigate it to |url|. | 119 // Launch |ie_mock| and navigate it to |url|. |
118 ACTION_P2(LaunchThisIEAndNavigate, ie_mock, url) { | 120 ACTION_P2(LaunchThisIEAndNavigate, ie_mock, url) { |
119 EXPECT_HRESULT_SUCCEEDED(ie_mock->event_sink()->LaunchIEAndNavigate(url, | 121 EXPECT_HRESULT_SUCCEEDED(ie_mock->event_sink()->LaunchIEAndNavigate(url, |
120 ie_mock)); | 122 ie_mock)); |
121 } | 123 } |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 326 |
325 // Start it up. Everything else is triggered as mock actions. | 327 // Start it up. Everything else is triggered as mock actions. |
326 ASSERT_HRESULT_SUCCEEDED( | 328 ASSERT_HRESULT_SUCCEEDED( |
327 ie_mock_.event_sink()->LaunchIEAndNavigate(top_url, &ie_mock_)); | 329 ie_mock_.event_sink()->LaunchIEAndNavigate(top_url, &ie_mock_)); |
328 | 330 |
329 // 3 navigations + 2 invocations of delete browser history == 5 | 331 // 3 navigations + 2 invocations of delete browser history == 5 |
330 loop_.RunFor(kChromeFrameLongNavigationTimeout * 5); | 332 loop_.RunFor(kChromeFrameLongNavigationTimeout * 5); |
331 } | 333 } |
332 | 334 |
333 } // namespace chrome_frame_test | 335 } // namespace chrome_frame_test |
OLD | NEW |