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 syncable::ModelEnumSet changed_types) { | 570 syncable::ModelTypeSet 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 syncable::ModelEnumSet model_types) { | 592 syncable::ModelTypeSet 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::ModelEnumSet::Iterator it = model_types.First(); | 596 for (syncable::ModelTypeSet::Iterator it = model_types.First(); |
597 it.Good(); it.Inc()) { | 597 it.Good(); it.Inc()) { |
598 path.append( | 598 path.append( |
599 base::StringPrintf( | 599 base::StringPrintf( |
600 "%ctype=%d", joiner, | 600 "%ctype=%d", joiner, |
601 syncable::GetExtensionFieldNumberFromModelType(it.Get()))); | 601 syncable::GetExtensionFieldNumberFromModelType(it.Get()))); |
602 joiner = '&'; | 602 joiner = '&'; |
603 } | 603 } |
604 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); | 604 ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); |
605 ASSERT_EQ("Migration: 200", | 605 ASSERT_EQ("Migration: 200", |
606 UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); | 606 UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 712 |
713 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, | 713 void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, |
714 const net::ProxyConfig& proxy_config) { | 714 const net::ProxyConfig& proxy_config) { |
715 base::WaitableEvent done(false, false); | 715 base::WaitableEvent done(false, false); |
716 BrowserThread::PostTask( | 716 BrowserThread::PostTask( |
717 BrowserThread::IO, FROM_HERE, | 717 BrowserThread::IO, FROM_HERE, |
718 base::Bind(&SetProxyConfigCallback, &done, | 718 base::Bind(&SetProxyConfigCallback, &done, |
719 make_scoped_refptr(context_getter), proxy_config)); | 719 make_scoped_refptr(context_getter), proxy_config)); |
720 done.Wait(); | 720 done.Wait(); |
721 } | 721 } |
OLD | NEW |