| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 #import <XCTest/XCTest.h> | 6 #import <XCTest/XCTest.h> |
| 7 | 7 |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "components/bookmarks/browser/bookmark_model.h" | 9 #include "components/bookmarks/browser/bookmark_model.h" |
| 10 #include "components/bookmarks/browser/titled_url_match.h" | 10 #include "components/bookmarks/browser/titled_url_match.h" |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 NSError* error = nil; | 424 NSError* error = nil; |
| 425 BOOL success = chrome_test_util::VerifySessionsOnSyncServer( | 425 BOOL success = chrome_test_util::VerifySessionsOnSyncServer( |
| 426 std::multiset<std::string>{URL1.spec(), URL2.spec()}, &error); | 426 std::multiset<std::string>{URL1.spec(), URL2.spec()}, &error); |
| 427 | 427 |
| 428 DCHECK(success || error); | 428 DCHECK(success || error); |
| 429 GREYAssertTrue(success, [error localizedDescription]); | 429 GREYAssertTrue(success, [error localizedDescription]); |
| 430 } | 430 } |
| 431 | 431 |
| 432 // Tests that a typed URL (after Sync is enabled) is uploaded to the Sync | 432 // Tests that a typed URL (after Sync is enabled) is uploaded to the Sync |
| 433 // server. | 433 // server. |
| 434 - (void)testSyncTypedURLUpload { | 434 // TODO(crbug.com/707846): Re-enable test. |
| 435 - (void)DISABLED_testSyncTypedURLUpload { |
| 435 const GURL mockURL("http://not-a-real-site/"); | 436 const GURL mockURL("http://not-a-real-site/"); |
| 436 | 437 |
| 437 chrome_test_util::ClearBrowsingHistory(); | 438 chrome_test_util::ClearBrowsingHistory(); |
| 438 | 439 |
| 439 [self setTearDownHandler:^{ | 440 [self setTearDownHandler:^{ |
| 440 chrome_test_util::ClearBrowsingHistory(); | 441 chrome_test_util::ClearBrowsingHistory(); |
| 441 }]; | 442 }]; |
| 442 chrome_test_util::AddTypedURLOnClient(mockURL); | 443 chrome_test_util::AddTypedURLOnClient(mockURL); |
| 443 | 444 |
| 444 // Sign in to sync. | 445 // Sign in to sync. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 // Delete typed URL from client. | 546 // Delete typed URL from client. |
| 546 chrome_test_util::DeleteTypedUrlFromClient(mockURL); | 547 chrome_test_util::DeleteTypedUrlFromClient(mockURL); |
| 547 | 548 |
| 548 // Trigger sync and wait for typed URL to be deleted. | 549 // Trigger sync and wait for typed URL to be deleted. |
| 549 chrome_test_util::TriggerSyncCycle(syncer::TYPED_URLS); | 550 chrome_test_util::TriggerSyncCycle(syncer::TYPED_URLS); |
| 550 AssertNumberOfEntities(0, syncer::TYPED_URLS); | 551 AssertNumberOfEntities(0, syncer::TYPED_URLS); |
| 551 } | 552 } |
| 552 | 553 |
| 553 // Test that typed url is deleted from client after server sends tombstone for | 554 // Test that typed url is deleted from client after server sends tombstone for |
| 554 // that typed url. | 555 // that typed url. |
| 555 - (void)testSyncTypedURLDeleteFromServer { | 556 // TODO(crbug.com/707846): Re-enable test. |
| 557 - (void)DISABLE_testSyncTypedURLDeleteFromServer { |
| 556 const GURL mockURL("http://not-a-real-site/"); | 558 const GURL mockURL("http://not-a-real-site/"); |
| 557 | 559 |
| 558 chrome_test_util::ClearBrowsingHistory(); | 560 chrome_test_util::ClearBrowsingHistory(); |
| 559 | 561 |
| 560 [self setTearDownHandler:^{ | 562 [self setTearDownHandler:^{ |
| 561 chrome_test_util::ClearBrowsingHistory(); | 563 chrome_test_util::ClearBrowsingHistory(); |
| 562 }]; | 564 }]; |
| 563 chrome_test_util::AddTypedURLOnClient(mockURL); | 565 chrome_test_util::AddTypedURLOnClient(mockURL); |
| 564 | 566 |
| 565 // Sign in to sync. | 567 // Sign in to sync. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 | 630 |
| 629 // Verify the correct number of bookmarks exist. | 631 // Verify the correct number of bookmarks exist. |
| 630 base::string16 matchString = base::SysNSStringToUTF16(title); | 632 base::string16 matchString = base::SysNSStringToUTF16(title); |
| 631 std::vector<bookmarks::TitledUrlMatch> matches; | 633 std::vector<bookmarks::TitledUrlMatch> matches; |
| 632 bookmarkModel->GetBookmarksMatching(matchString, 50, &matches); | 634 bookmarkModel->GetBookmarksMatching(matchString, 50, &matches); |
| 633 const size_t count = matches.size(); | 635 const size_t count = matches.size(); |
| 634 GREYAssertEqual(expectedCount, count, @"Unexpected number of bookmarks"); | 636 GREYAssertEqual(expectedCount, count, @"Unexpected number of bookmarks"); |
| 635 } | 637 } |
| 636 | 638 |
| 637 @end | 639 @end |
| OLD | NEW |