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

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

Issue 8082019: more content exports needed for unit_tests and browser_tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert export of browser_accessibility_win for now Created 9 years, 2 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 form_structure = new FormStructure(form); 325 form_structure = new FormStructure(form);
326 form_structures.push_back(form_structure); 326 form_structures.push_back(form_structure);
327 327
328 // Request with id 3. 328 // Request with id 3.
329 EXPECT_CALL(mock_metric_logger, 329 EXPECT_CALL(mock_metric_logger,
330 LogServerQueryMetric(AutofillMetrics::QUERY_SENT)).Times(1); 330 LogServerQueryMetric(AutofillMetrics::QUERY_SENT)).Times(1);
331 EXPECT_TRUE(download_manager.StartQueryRequest(form_structures, 331 EXPECT_TRUE(download_manager.StartQueryRequest(form_structures,
332 mock_metric_logger)); 332 mock_metric_logger));
333 fetcher = factory.GetFetcherByID(3); 333 fetcher = factory.GetFetcherByID(3);
334 ASSERT_TRUE(fetcher); 334 ASSERT_TRUE(fetcher);
335 fetcher->set_backoff_delay( 335 fetcher->set_backoff_delay_for_testing(
336 base::TimeDelta::FromMilliseconds(TestTimeouts::action_max_timeout_ms())); 336 base::TimeDelta::FromMilliseconds(TestTimeouts::action_max_timeout_ms()));
337 FakeOnURLFetchComplete(fetcher, 500, std::string(responses[0])); 337 FakeOnURLFetchComplete(fetcher, 500, std::string(responses[0]));
338 338
339 EXPECT_EQ(AutofillDownloadTest::REQUEST_QUERY_FAILED, 339 EXPECT_EQ(AutofillDownloadTest::REQUEST_QUERY_FAILED,
340 responses_.front().type_of_response); 340 responses_.front().type_of_response);
341 EXPECT_EQ(500, responses_.front().error); 341 EXPECT_EQ(500, responses_.front().error);
342 // Expected response on non-query request is an empty string. 342 // Expected response on non-query request is an empty string.
343 EXPECT_EQ(std::string(), responses_.front().response); 343 EXPECT_EQ(std::string(), responses_.front().response);
344 responses_.pop_front(); 344 responses_.pop_front();
345 345
346 // Query requests should be ignored for the next 10 seconds. 346 // Query requests should be ignored for the next 10 seconds.
347 EXPECT_CALL(mock_metric_logger, 347 EXPECT_CALL(mock_metric_logger,
348 LogServerQueryMetric(AutofillMetrics::QUERY_SENT)).Times(0); 348 LogServerQueryMetric(AutofillMetrics::QUERY_SENT)).Times(0);
349 EXPECT_FALSE(download_manager.StartQueryRequest(form_structures, 349 EXPECT_FALSE(download_manager.StartQueryRequest(form_structures,
350 mock_metric_logger)); 350 mock_metric_logger));
351 fetcher = factory.GetFetcherByID(4); 351 fetcher = factory.GetFetcherByID(4);
352 EXPECT_EQ(NULL, fetcher); 352 EXPECT_EQ(NULL, fetcher);
353 353
354 // Set upload required to true so requests happen. 354 // Set upload required to true so requests happen.
355 form_structures[0]->upload_required_ = UPLOAD_REQUIRED; 355 form_structures[0]->upload_required_ = UPLOAD_REQUIRED;
356 // Request with id 4. 356 // Request with id 4.
357 EXPECT_TRUE(download_manager.StartUploadRequest( 357 EXPECT_TRUE(download_manager.StartUploadRequest(
358 *(form_structures[0]), true, FieldTypeSet())); 358 *(form_structures[0]), true, FieldTypeSet()));
359 fetcher = factory.GetFetcherByID(4); 359 fetcher = factory.GetFetcherByID(4);
360 ASSERT_TRUE(fetcher); 360 ASSERT_TRUE(fetcher);
361 fetcher->set_backoff_delay( 361 fetcher->set_backoff_delay_for_testing(
362 base::TimeDelta::FromMilliseconds(TestTimeouts::action_max_timeout_ms())); 362 base::TimeDelta::FromMilliseconds(TestTimeouts::action_max_timeout_ms()));
363 FakeOnURLFetchComplete(fetcher, 503, std::string(responses[2])); 363 FakeOnURLFetchComplete(fetcher, 503, std::string(responses[2]));
364 EXPECT_EQ(AutofillDownloadTest::REQUEST_UPLOAD_FAILED, 364 EXPECT_EQ(AutofillDownloadTest::REQUEST_UPLOAD_FAILED,
365 responses_.front().type_of_response); 365 responses_.front().type_of_response);
366 EXPECT_EQ(503, responses_.front().error); 366 EXPECT_EQ(503, responses_.front().error);
367 responses_.pop_front(); 367 responses_.pop_front();
368 368
369 // Upload requests should be ignored for the next 10 seconds. 369 // Upload requests should be ignored for the next 10 seconds.
370 EXPECT_FALSE(download_manager.StartUploadRequest( 370 EXPECT_FALSE(download_manager.StartUploadRequest(
371 *(form_structures[0]), true, FieldTypeSet())); 371 *(form_structures[0]), true, FieldTypeSet()));
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 mock_metric_logger)); 523 mock_metric_logger));
524 // No responses yet 524 // No responses yet
525 EXPECT_EQ(static_cast<size_t>(0), responses_.size()); 525 EXPECT_EQ(static_cast<size_t>(0), responses_.size());
526 526
527 fetcher = factory.GetFetcherByID(3); 527 fetcher = factory.GetFetcherByID(3);
528 ASSERT_TRUE(fetcher); 528 ASSERT_TRUE(fetcher);
529 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0])); 529 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0]));
530 ASSERT_EQ(static_cast<size_t>(1), responses_.size()); 530 ASSERT_EQ(static_cast<size_t>(1), responses_.size());
531 EXPECT_EQ(responses[0], responses_.front().response); 531 EXPECT_EQ(responses[0], responses_.front().response);
532 } 532 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698