12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string> 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <vector> 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h" 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/compiler_specific.h" 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_vector.h" 15a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)#include "chrome/test/base/in_process_browser_test.h" 162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "net/dns/mock_host_resolver.h" 17f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "net/http/http_status_code.h" 18f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "net/url_request/url_request_status.h" 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "sync/internal_api/public/base/model_type.h" 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "sync/protocol/sync_protocol_error.h" 215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "sync/test/fake_server/fake_server.h" 222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "sync/test/local_sync_test_server.h" 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Profile; 25e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdochclass ProfileSyncService; 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ProfileSyncServiceHarness; 27effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochclass P2PInvalidationForwarder; 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace base { 30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class CommandLine; 31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} 32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 330529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochnamespace fake_server { 340529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochclass FakeServer; 35010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)class FakeServerInvalidationService; 360529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch} 370529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace net { 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class FakeURLFetcherFactory; 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ProxyConfig; 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ScopedDefaultHostResolverProc; 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class URLFetcherImplFactory; 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class URLRequestContextGetter; 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This is the base class for integration tests for all sync data types. Derived 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// classes must be defined for each sync data type. Individual tests are defined 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// using the IN_PROC_BROWSER_TEST_F macro. 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SyncTest : public InProcessBrowserTest { 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The different types of live sync tests that can be implemented. 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) enum TestType { 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Tests where only one client profile is synced with the server. Typically 54c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch // sanity level tests. 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SINGLE_CLIENT, 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 57c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch // Tests that use one client profile and are not compatible with 58c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch // FakeServer. 59c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch // TODO(pvalenzuela): Delete this value when all SINGLE_CLIENT_LEGACY tests 60c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch // are compatible with FakeServer and switched to SINGLE_CLIENT. See 61c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch // crbug.com/323265. 62effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch SINGLE_CLIENT_LEGACY, 63effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Tests where two client profiles are synced with the server. Typically 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // functionality level tests. 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) TWO_CLIENT, 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 68c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch // Tests that use two client profiles and are not compatible with 69c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch // FakeServer. 70c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch // TODO(pvalenzuela): Delete this value when all TWO_CLIENT_LEGACY tests are 71c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch // compatible with FakeServer and switched to TWO_CLIENT. See 72c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch // crbug.com/323265. 73c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch TWO_CLIENT_LEGACY, 74c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Tests where three or more client profiles are synced with the server. 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Typically, these tests create client side races and verify that sync 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // works. 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) MULTIPLE_CLIENT 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) }; 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The type of server we're running against. 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) enum ServerType { 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SERVER_TYPE_UNDECIDED, 845d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) LOCAL_PYTHON_SERVER, // The mock python server that runs locally and is 855d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // part of the Chromium checkout. 865d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) LOCAL_LIVE_SERVER, // Some other server (maybe the real binary used by 875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Google's sync service) that can be started on 885d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // a per-test basis by running a command 895d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) EXTERNAL_LIVE_SERVER, // A remote server that the test code has no control 905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // over whatsoever; cross your fingers that the 915d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // account state is initially clean. 925d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) IN_PROCESS_FAKE_SERVER, // The fake Sync server (FakeServer) running 935d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // in-process (bypassing HTTP calls). This 945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // ServerType will eventually replace 955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // LOCAL_PYTHON_SERVER. 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) }; 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // NOTE: IMPORTANT the enum here should match with 995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the enum defined on the chromiumsync.py test server impl. 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) enum SyncErrorFrequency { 1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Uninitialized state. 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ERROR_FREQUENCY_NONE, 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Server sends the error on all requests. 1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ERROR_FREQUENCY_ALWAYS, 1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Server sends the error on two thirds of the request. 1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Note this is not random. The server would send the 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // error on the first 2 requests of every 3 requests. 1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ERROR_FREQUENCY_TWO_THIRDS 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) }; 1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // A SyncTest must be associated with a particular test type. 1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) explicit SyncTest(TestType test_type); 1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ~SyncTest(); 1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Validates command line parameters and creates a local python test server if 1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // specified. 1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void SetUp() OVERRIDE; 1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Brings down local python test server if one was created. 1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void TearDown() OVERRIDE; 1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Sets up command line flags required for sync tests. 126a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual void SetUpCommandLine(base::CommandLine* cl) OVERRIDE; 1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used to get the number of sync clients used by a test. 1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int num_clients() WARN_UNUSED_RESULT { return num_clients_; } 1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns a pointer to a particular sync profile. Callee owns the object 1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // and manages its lifetime. 1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Profile* GetProfile(int index) WARN_UNUSED_RESULT; 1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns a pointer to a particular browser. Callee owns the object 1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // and manages its lifetime. 1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Browser* GetBrowser(int index) WARN_UNUSED_RESULT; 1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns a pointer to a particular sync client. Callee owns the object 1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // and manages its lifetime. 1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ProfileSyncServiceHarness* GetClient(int index) WARN_UNUSED_RESULT; 1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns a reference to the collection of sync clients. Callee owns the 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // object and manages its lifetime. 1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) std::vector<ProfileSyncServiceHarness*>& clients() WARN_UNUSED_RESULT { 1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return clients_.get(); 1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 149e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch // Returns a ProfileSyncService at the given index. 150e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch ProfileSyncService* GetSyncService(int index); 151e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch 152e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch // Returns the set of ProfileSyncServices. 153e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch std::vector<ProfileSyncService*> GetSyncServices(); 154e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch 1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns a pointer to the sync profile that is used to verify changes to 1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // individual sync profiles. Callee owns the object and manages its lifetime. 1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Profile* verifier() WARN_UNUSED_RESULT; 1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used to determine whether the verifier profile should be updated or not. 1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool use_verifier() WARN_UNUSED_RESULT { return use_verifier_; } 1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // After calling this method, changes made to a profile will no longer be 1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // reflected in the verifier profile. Note: Not all datatypes use this. 1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // TODO(rsimha): Hook up all datatypes to this mechanism. 1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void DisableVerifier(); 1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Initializes sync clients and profiles but does not sync any of them. 1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool SetupClients() WARN_UNUSED_RESULT; 1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Initializes sync clients and profiles if required and syncs each of them. 1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool SetupSync() WARN_UNUSED_RESULT; 1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Enable outgoing network connections for the given profile. 1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void EnableNetwork(Profile* profile); 1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Disable outgoing network connections for the given profile. 1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void DisableNetwork(Profile* profile); 1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 179e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch // Sets whether or not the sync clients in this test should respond to 180e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch // notifications of their own commits. Real sync clients do not do this, but 181e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch // many test assertions require this behavior. 182e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch // 183e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch // Default is to return true. Test should override this if they require 184e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch // different behavior. 185e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch virtual bool TestUsesSelfNotifications(); 186e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch 1875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Kicks off encryption for profile |index|. 1885d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool EnableEncryption(int index); 1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Checks if encryption is complete for profile |index|. 1915d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool IsEncryptionComplete(int index); 1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 193116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // Waits until IsEncryptionComplete returns true or a timeout is reached. 194116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch bool AwaitEncryptionComplete(int index); 195116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Blocks until all sync clients have completed their mutual sync cycles. 1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if a quiescent state was successfully reached. 1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool AwaitQuiescence(); 1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if the server being used supports controlling 2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // notifications. 2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool ServerSupportsNotificationControl() const; 2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Disable notifications on the server. This operation is available 2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // only if ServerSupportsNotificationControl() returned true. 2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void DisableNotifications(); 2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Enable notifications on the server. This operation is available 2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // only if ServerSupportsNotificationControl() returned true. 2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void EnableNotifications(); 2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 212f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Sets the mock gaia response for when an OAuth2 token is requested. 213f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Each call to this method will overwrite responses that were previously set. 214f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) void SetOAuth2TokenResponse(const std::string& response_data, 215f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) net::HttpStatusCode response_code, 216f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) net::URLRequestStatus::Status status); 217f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Trigger a notification to be sent to all clients. This operation 2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // is available only if ServerSupportsNotificationControl() returned 2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // true. 2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void TriggerNotification(syncer::ModelTypeSet changed_types); 2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if the server being used supports injecting errors. 2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool ServerSupportsErrorTriggering() const; 2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Triggers a migration for one or more datatypes, and waits 2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // for the server to complete it. This operation is available 2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // only if ServerSupportsErrorTriggering() returned true. 2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void TriggerMigrationDoneError(syncer::ModelTypeSet model_types); 2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Triggers a transient error on the server. Note the server will stay in 2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // this state until shut down. 2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void TriggerTransientError(); 2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Triggers an XMPP auth error on the server. Note the server will 2362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // stay in this state until shut down. 2372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void TriggerXmppAuthError(); 2382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Triggers a sync error on the server. 2405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // error: The error the server is expected to return. 2415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // frequency: Frequency with which the error is returned. 2425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void TriggerSyncError(const syncer::SyncProtocolError& error, 2435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SyncErrorFrequency frequency); 2445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Triggers the creation the Synced Bookmarks folder on the server. 2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void TriggerCreateSyncedBookmarks(); 2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2480529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch // Returns the FakeServer being used for the test or NULL if FakeServer is 2490529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch // not being used. 2500529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch fake_server::FakeServer* GetFakeServer() const; 2510529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch 2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected: 2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Add custom switches needed for running the test. 254a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual void AddTestSwitches(base::CommandLine* cl); 2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Append the command line switches to enable experimental types that aren't 2575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // on by default yet. 258a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual void AddOptionalTypesToCommandLine(base::CommandLine* cl); 2595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2605f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) // BrowserTestBase override. Destroys all the sync clients and sync 2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // profiles created by a test. 2625f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) virtual void TearDownOnMainThread() OVERRIDE; 2635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // InProcessBrowserTest override. Changes behavior of the default host 2655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // resolver to avoid DNS lookup errors. 2665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; 2675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // InProcessBrowserTest override. Resets the host resolver its default 2695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // behavior. 2705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; 2715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Creates Profile, Browser and ProfileSyncServiceHarness instances for 2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // |index|. Used by SetupClients(). 2745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void InitializeInstance(int index); 2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Implementations of the EnableNotifications() and DisableNotifications() 2775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // functions defined above. 2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void DisableNotificationsImpl(); 2795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void EnableNotificationsImpl(); 2805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // GAIA account used by the test case. 2825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) std::string username_; 2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // GAIA password used by the test case. 2855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) std::string password_; 2865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Locally available plain text file in which GAIA credentials are stored. 2882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) base::FilePath password_file_; 2895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // The FakeServer used in tests with server type IN_PROCESS_FAKE_SERVER. 291a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) scoped_ptr<fake_server::FakeServer> fake_server_; 2925d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 2935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private: 2945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Helper to ProfileManager::CreateProfile that handles path creation. 2952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) static Profile* MakeProfile(const base::FilePath::StringType name); 2965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Helper method used to read GAIA credentials from a local password file 2985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // specified via the "--password-file-for-test" command line switch. 2995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Note: The password file must be a plain text file with exactly two lines -- 3005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the username on the first line and the password on the second line. 3015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void ReadPasswordFile(); 3025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Helper method that starts up a sync test server if required. 3045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void SetUpTestServerIfRequired(); 3055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Helper method used to start up a local python test server. Note: We set up 3075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // an XMPP-only python server if |server_type_| is LOCAL_LIVE_SERVER and mock 3085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // gaia credentials are in use. Returns true if successful. 3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool SetUpLocalPythonTestServer(); 3105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Helper method used to start up a local sync test server. Returns true if 3125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // successful. 3135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool SetUpLocalTestServer(); 3145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Helper method used to destroy the local python sync test server if one was 3165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // created. Returns true if successful. 3175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool TearDownLocalPythonTestServer(); 3185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Helper method used to destroy the local sync test server if one was 3205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // created. Returns true if successful. 3215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool TearDownLocalTestServer(); 3225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Helper method that waits for up to |wait| for the test server 3245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // to start. Splits the time into |intervals| intervals, and polls the 3255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // server after each interval to see if it has started. Returns true if 3265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // successful. 3275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool WaitForTestServerToStart(base::TimeDelta wait, int intervals); 3285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Helper method used to check if the test server is up and running. 3305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool IsTestServerRunning(); 3315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used to disable and enable network connectivity by providing and 3335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // clearing an invalid proxy configuration. 3345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void SetProxyConfig(net::URLRequestContextGetter* context, 3355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const net::ProxyConfig& proxy_config); 3365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3375f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) void SetupNetwork(net::URLRequestContextGetter* context); 3385f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 3395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Helper method used to set up fake responses for kClientLoginUrl, 3405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // kIssueAuthTokenUrl, kGetUserInfoUrl and kSearchDomainCheckUrl in order to 3415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // mock out calls to GAIA servers. 3425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void SetupMockGaiaResponses(); 3435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Helper method used to clear any fake responses that might have been set for 3455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // various gaia URLs, cancel any outstanding URL requests, and return to using 3465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the default URLFetcher creation mechanism. 3475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void ClearMockGaiaResponses(); 3485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 349effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch // Decide which sync server implementation to run against based on the type 350effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch // of test being run and command line args passed in. 351effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch void DecideServerType(); 352effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 353010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) // Sets up the client-side invalidations infrastructure depending on the 354010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) // value of |server_type_|. 355010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) void InitializeInvalidations(int index); 356010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) 3572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Python sync test server, started on demand. 3582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) syncer::LocalSyncTestServer sync_server_; 3595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Helper class to whitelist the notification port. 3615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<net::ScopedPortException> xmpp_port_; 3625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used to differentiate between single-client, two-client, multi-client and 3645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // many-client tests. 3655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) TestType test_type_; 3665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Tells us what kind of server we're using (some tests run only on certain 3685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // server types). 3695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ServerType server_type_; 3705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Number of sync clients that will be created by a test. 3725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int num_clients_; 3735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Collection of sync profiles used by a test. A sync profile maintains sync 3755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // data contained within its own subdirectory under the chrome user data 3765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // directory. Profiles are owned by the ProfileManager. 3775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) std::vector<Profile*> profiles_; 3785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Collection of pointers to the browser objects used by a test. One browser 3805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // instance is created for each sync profile. Browser object lifetime is 3815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // managed by BrowserList, so we don't use a ScopedVector here. 3825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) std::vector<Browser*> browsers_; 3835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Collection of sync clients used by a test. A sync client is associated with 3855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // a sync profile, and implements methods that sync the contents of the 3865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // profile with the server. 3875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ScopedVector<ProfileSyncServiceHarness> clients_; 3885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 389effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch // A set of objects to listen for commit activity and broadcast notifications 390effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch // of this activity to its peer sync clients. 391effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch ScopedVector<P2PInvalidationForwarder> invalidation_forwarders_; 392effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 393010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) // Collection of pointers to FakeServerInvalidation objects for each profile. 394010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) std::vector<fake_server::FakeServerInvalidationService*> 395010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) fake_server_invalidation_services_; 396010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) 3975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Sync profile against which changes to individual profiles are verified. We 3985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // don't need a corresponding verifier sync client because the contents of the 3995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // verifier profile are strictly local, and are not meant to be synced. 4005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Profile* verifier_; 4015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Indicates whether changes to a profile should also change the verifier 4035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // profile or not. 4045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool use_verifier_; 4055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Indicates whether or not notifications were explicitly enabled/disabled. 4075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Defaults to true. 4085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool notifications_enabled_; 4095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Sync integration tests need to make live DNS requests for access to 4115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // GAIA and sync server URLs under google.com. We use a scoped version 4125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // to override the default resolver while the test is active. 4135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<net::ScopedDefaultHostResolverProc> mock_host_resolver_override_; 4145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used to start and stop the local test server. 4165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) base::ProcessHandle test_server_handle_; 4175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Fake URLFetcher factory used to mock out GAIA signin. 4195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<net::FakeURLFetcherFactory> fake_factory_; 4205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The URLFetcherImplFactory instance used to instantiate |fake_factory_|. 4225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<net::URLFetcherImplFactory> factory_; 4235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(SyncTest); 4255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 4265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ 428