OLD | NEW |
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 "chrome/browser/sync/test/integration/sync_test.h" | 5 #include "chrome/browser/sync/test/integration/sync_test.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 | 560 |
561 void SyncTest::EnableNotifications() { | 561 void SyncTest::EnableNotifications() { |
562 ASSERT_TRUE(ServerSupportsNotificationControl()); | 562 ASSERT_TRUE(ServerSupportsNotificationControl()); |
563 std::string path = "chromiumsync/enablenotifications"; | 563 std::string path = "chromiumsync/enablenotifications"; |
564 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); | 564 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); |
565 ASSERT_EQ("Notifications enabled", | 565 ASSERT_EQ("Notifications enabled", |
566 UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); | 566 UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); |
567 } | 567 } |
568 | 568 |
569 void SyncTest::TriggerNotification( | 569 void SyncTest::TriggerNotification( |
570 const syncable::ModelTypeSet& changed_types) { | 570 syncable::ModelEnumSet changed_types) { |
571 ASSERT_TRUE(ServerSupportsNotificationControl()); | 571 ASSERT_TRUE(ServerSupportsNotificationControl()); |
572 const std::string& data = | 572 const std::string& data = |
573 sync_notifier::P2PNotificationData("from_server", | 573 sync_notifier::P2PNotificationData("from_server", |
574 sync_notifier::NOTIFY_ALL, | 574 sync_notifier::NOTIFY_ALL, |
575 changed_types).ToString(); | 575 changed_types).ToString(); |
576 const std::string& path = | 576 const std::string& path = |
577 std::string("chromiumsync/sendnotification?channel=") + | 577 std::string("chromiumsync/sendnotification?channel=") + |
578 sync_notifier::kSyncP2PNotificationChannel + "&data=" + data; | 578 sync_notifier::kSyncP2PNotificationChannel + "&data=" + data; |
579 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); | 579 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); |
580 ASSERT_EQ("Notification sent", | 580 ASSERT_EQ("Notification sent", |
581 UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); | 581 UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); |
582 } | 582 } |
583 | 583 |
584 bool SyncTest::ServerSupportsErrorTriggering() const { | 584 bool SyncTest::ServerSupportsErrorTriggering() const { |
585 EXPECT_NE(SERVER_TYPE_UNDECIDED, server_type_); | 585 EXPECT_NE(SERVER_TYPE_UNDECIDED, server_type_); |
586 | 586 |
587 // Supported only if we're using the python testserver. | 587 // Supported only if we're using the python testserver. |
588 return server_type_ == LOCAL_PYTHON_SERVER; | 588 return server_type_ == LOCAL_PYTHON_SERVER; |
589 } | 589 } |
590 | 590 |
591 void SyncTest::TriggerMigrationDoneError( | 591 void SyncTest::TriggerMigrationDoneError( |
592 const syncable::ModelTypeSet& model_types) { | 592 syncable::ModelEnumSet model_types) { |
593 ASSERT_TRUE(ServerSupportsErrorTriggering()); | 593 ASSERT_TRUE(ServerSupportsErrorTriggering()); |
594 std::string path = "chromiumsync/migrate"; | 594 std::string path = "chromiumsync/migrate"; |
595 char joiner = '?'; | 595 char joiner = '?'; |
596 for (syncable::ModelTypeSet::const_iterator it = model_types.begin(); | 596 for (syncable::ModelEnumSet::Iterator it = model_types.First(); |
597 it != model_types.end(); ++it) { | 597 it.Good(); it.Inc()) { |
598 path.append(base::StringPrintf("%ctype=%d", joiner, | 598 path.append( |
599 syncable::GetExtensionFieldNumberFromModelType(*it))); | 599 base::StringPrintf( |
| 600 "%ctype=%d", joiner, |
| 601 syncable::GetExtensionFieldNumberFromModelType(it.Get()))); |
600 joiner = '&'; | 602 joiner = '&'; |
601 } | 603 } |
602 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); | 604 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); |
603 ASSERT_EQ("Migration: 200", | 605 ASSERT_EQ("Migration: 200", |
604 UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); | 606 UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); |
605 } | 607 } |
606 | 608 |
607 void SyncTest::TriggerBirthdayError() { | 609 void SyncTest::TriggerBirthdayError() { |
608 ASSERT_TRUE(ServerSupportsErrorTriggering()); | 610 ASSERT_TRUE(ServerSupportsErrorTriggering()); |
609 std::string path = "chromiumsync/birthdayerror"; | 611 std::string path = "chromiumsync/birthdayerror"; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 | 712 |
711 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, | 713 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, |
712 const net::ProxyConfig& proxy_config) { | 714 const net::ProxyConfig& proxy_config) { |
713 base::WaitableEvent done(false, false); | 715 base::WaitableEvent done(false, false); |
714 BrowserThread::PostTask( | 716 BrowserThread::PostTask( |
715 BrowserThread::IO, FROM_HERE, | 717 BrowserThread::IO, FROM_HERE, |
716 base::Bind(&SetProxyConfigCallback, &done, | 718 base::Bind(&SetProxyConfigCallback, &done, |
717 make_scoped_refptr(context_getter), proxy_config)); | 719 make_scoped_refptr(context_getter), proxy_config)); |
718 done.Wait(); | 720 done.Wait(); |
719 } | 721 } |
OLD | NEW |