OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_TEST_LIVE_SYNC_LIVE_SYNC_TEST_H_ | 5 #ifndef CHROME_TEST_LIVE_SYNC_LIVE_SYNC_TEST_H_ |
6 #define CHROME_TEST_LIVE_SYNC_LIVE_SYNC_TEST_H_ | 6 #define CHROME_TEST_LIVE_SYNC_LIVE_SYNC_TEST_H_ |
7 | 7 |
8 #include "chrome/test/in_process_browser_test.h" | 8 #include "chrome/test/in_process_browser_test.h" |
9 | 9 |
10 #include "base/scoped_vector.h" | 10 #include "base/scoped_vector.h" |
11 #include "chrome/test/live_sync/profile_sync_service_test_harness.h" | 11 #include "chrome/test/live_sync/profile_sync_service_test_harness.h" |
12 #include "net/base/mock_host_resolver.h" | 12 #include "net/base/mock_host_resolver.h" |
13 #include "net/socket/ssl_test_util.h" | 13 #include "net/socket/ssl_test_util.h" |
14 | 14 |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 class Profile; | 17 class Profile; |
18 class CommandLine; | 18 class CommandLine; |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 class ScopedDefaultHostResolverProc; | 21 class ScopedDefaultHostResolverProc; |
22 } | 22 } |
23 | 23 |
24 namespace switches { | 24 namespace switches { |
25 extern const wchar_t kSyncUserForTest[]; | 25 extern const wchar_t kSyncUserForTest[]; |
26 extern const wchar_t kSyncPasswordForTest[]; | 26 extern const wchar_t kSyncPasswordForTest[]; |
27 } | 27 } |
28 | 28 |
| 29 // Live sync tests are allowed to run for up to 5 minutes. |
| 30 const int kTestTimeoutInMS = 300000; |
| 31 |
29 // This is the base class for integration tests for all sync data types. Derived | 32 // This is the base class for integration tests for all sync data types. Derived |
30 // classes must be defined for each sync data type. Individual tests are defined | 33 // classes must be defined for each sync data type. Individual tests are defined |
31 // using the IN_PROC_BROWSER_TEST_F macro. | 34 // using the IN_PROC_BROWSER_TEST_F macro. |
32 class LiveSyncTest : public InProcessBrowserTest { | 35 class LiveSyncTest : public InProcessBrowserTest { |
33 public: | 36 public: |
34 // The different types of live sync tests that can be implemented. | 37 // The different types of live sync tests that can be implemented. |
35 enum TestType { | 38 enum TestType { |
36 // Tests where only one client profile is synced with the server. Typically | 39 // Tests where only one client profile is synced with the server. Typically |
37 // sanity level tests. | 40 // sanity level tests. |
38 SINGLE_CLIENT, | 41 SINGLE_CLIENT, |
(...skipping 10 matching lines...) Expand all Loading... |
49 // by stress tests. | 52 // by stress tests. |
50 MANY_CLIENT | 53 MANY_CLIENT |
51 }; | 54 }; |
52 | 55 |
53 // A LiveSyncTest must be associated with a particular test type. | 56 // A LiveSyncTest must be associated with a particular test type. |
54 explicit LiveSyncTest(TestType test_type) | 57 explicit LiveSyncTest(TestType test_type) |
55 : test_type_(test_type), | 58 : test_type_(test_type), |
56 num_clients_(-1), | 59 num_clients_(-1), |
57 started_local_test_server_(false) { | 60 started_local_test_server_(false) { |
58 InProcessBrowserTest::set_show_window(true); | 61 InProcessBrowserTest::set_show_window(true); |
| 62 InProcessBrowserTest::SetInitialTimeoutInMS(kTestTimeoutInMS); |
59 switch (test_type_) { | 63 switch (test_type_) { |
60 case SINGLE_CLIENT: { | 64 case SINGLE_CLIENT: { |
61 num_clients_ = 1; | 65 num_clients_ = 1; |
62 break; | 66 break; |
63 } | 67 } |
64 case TWO_CLIENT: { | 68 case TWO_CLIENT: { |
65 num_clients_ = 2; | 69 num_clients_ = 2; |
66 break; | 70 break; |
67 } | 71 } |
68 case MULTIPLE_CLIENT: { | 72 case MULTIPLE_CLIENT: { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 170 |
167 // Sync integration tests need to make live DNS requests for access to | 171 // Sync integration tests need to make live DNS requests for access to |
168 // GAIA and sync server URLs under google.com. We use a scoped version | 172 // GAIA and sync server URLs under google.com. We use a scoped version |
169 // to override the default resolver while the test is active. | 173 // to override the default resolver while the test is active. |
170 scoped_ptr<net::ScopedDefaultHostResolverProc> mock_host_resolver_override_; | 174 scoped_ptr<net::ScopedDefaultHostResolverProc> mock_host_resolver_override_; |
171 | 175 |
172 DISALLOW_COPY_AND_ASSIGN(LiveSyncTest); | 176 DISALLOW_COPY_AND_ASSIGN(LiveSyncTest); |
173 }; | 177 }; |
174 | 178 |
175 #endif // CHROME_TEST_LIVE_SYNC_LIVE_SYNC_TEST_H_ | 179 #endif // CHROME_TEST_LIVE_SYNC_LIVE_SYNC_TEST_H_ |
OLD | NEW |