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

Side by Side Diff: chrome/browser/autofill/autofill_download_unittest.cc

Issue 6213002: Propagate correct data to the Toolbar servers (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <list> 5 #include <list>
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/test/test_timeouts.h" 8 #include "base/test/test_timeouts.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/autofill/autofill_download.h" 10 #include "chrome/browser/autofill/autofill_download.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 // Upload requests should be ignored for the next 10 seconds. 323 // Upload requests should be ignored for the next 10 seconds.
324 EXPECT_FALSE(helper.download_manager.StartUploadRequest(*(form_structures[0]), 324 EXPECT_FALSE(helper.download_manager.StartUploadRequest(*(form_structures[0]),
325 true)); 325 true));
326 fetcher = factory.GetFetcherByID(5); 326 fetcher = factory.GetFetcherByID(5);
327 EXPECT_EQ(NULL, fetcher); 327 EXPECT_EQ(NULL, fetcher);
328 328
329 // Make sure consumer of URLFetcher does the right thing. 329 // Make sure consumer of URLFetcher does the right thing.
330 URLFetcher::set_factory(NULL); 330 URLFetcher::set_factory(NULL);
331 } 331 }
332
333 TEST(AutoFillDownloadTest, DataPresence) {
334 AutoFillDownloadManager download_manager(NULL);
335
336 download_manager.ClearPresence();
337
338 EXPECT_EQ("", download_manager.ConvertPresenceBitsToString());
339
340 download_manager.SetPresenceBit(UNKNOWN_TYPE);
341 EXPECT_EQ("40", download_manager.ConvertPresenceBitsToString());
342
343 download_manager.ClearPresence();
344 download_manager.SetPresenceBit(PHONE_HOME_WHOLE_NUMBER);
345 EXPECT_EQ("0002", download_manager.ConvertPresenceBitsToString());
346
347 download_manager.SetPresenceBit(UNKNOWN_TYPE);
348 EXPECT_EQ("4002", download_manager.ConvertPresenceBitsToString());
349
350 download_manager.SetPresenceBit(ADDRESS_BILLING_LINE1);
351 download_manager.SetPresenceBit(ADDRESS_BILLING_LINE2);
352 download_manager.SetPresenceBit(ADDRESS_BILLING_CITY);
353 download_manager.SetPresenceBit(ADDRESS_BILLING_STATE);
354 download_manager.SetPresenceBit(ADDRESS_BILLING_ZIP);
355 EXPECT_EQ("4002000006e0", download_manager.ConvertPresenceBitsToString());
356
357 download_manager.SetPresenceBit(CREDIT_CARD_NUMBER);
358 download_manager.SetPresenceBit(COMPANY_NAME);
359 EXPECT_EQ("4002000006e00808", download_manager.ConvertPresenceBitsToString());
360
361 for (size_t i = 0; i < MAX_VALID_FIELD_TYPE; ++i)
362 download_manager.SetPresenceBit(static_cast<AutoFillFieldType>(i));
363
364 EXPECT_EQ("fffffffffffffff8", download_manager.ConvertPresenceBitsToString());
365 }
366
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698