Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: components/sync/test/local_sync_test_server.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/sync/test/local_sync_test_server.h ('k') | components/sync/test/mock_invalidation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "sync/test/local_sync_test_server.h" 5 #include "components/sync/test/local_sync_test_server.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "net/test/python_utils.h" 15 #include "net/test/python_utils.h"
16 #include "net/test/spawned_test_server/spawned_test_server.h" 16 #include "net/test/spawned_test_server/spawned_test_server.h"
17 17
18 namespace syncer { 18 namespace syncer {
19 19
20 LocalSyncTestServer::LocalSyncTestServer() 20 LocalSyncTestServer::LocalSyncTestServer()
21 : LocalTestServer( 21 : LocalTestServer(
22 net::SpawnedTestServer::TYPE_HTTP, // Sync uses the HTTP scheme. 22 net::SpawnedTestServer::TYPE_HTTP, // Sync uses the HTTP scheme.
23 net::SpawnedTestServer::kLocalhost, 23 net::SpawnedTestServer::kLocalhost,
24 base::FilePath()), 24 base::FilePath()),
25 xmpp_port_(0) {} 25 xmpp_port_(0) {}
26 26
27 LocalSyncTestServer::LocalSyncTestServer(uint16_t port, uint16_t xmpp_port) 27 LocalSyncTestServer::LocalSyncTestServer(uint16_t port, uint16_t xmpp_port)
28 : LocalTestServer( 28 : LocalTestServer(
29 net::SpawnedTestServer::TYPE_HTTP, // Sync uses the HTTP scheme. 29 net::SpawnedTestServer::TYPE_HTTP, // Sync uses the HTTP scheme.
30 net::SpawnedTestServer::kLocalhost, 30 net::SpawnedTestServer::kLocalhost,
31 base::FilePath()), 31 base::FilePath()),
32 xmpp_port_(xmpp_port) { 32 xmpp_port_(xmpp_port) {
33 SetPort(port); 33 SetPort(port);
34 } 34 }
(...skipping 11 matching lines...) Expand all
46 return true; 46 return true;
47 } 47 }
48 48
49 bool LocalSyncTestServer::GetTestServerPath( 49 bool LocalSyncTestServer::GetTestServerPath(
50 base::FilePath* testserver_path) const { 50 base::FilePath* testserver_path) const {
51 base::FilePath testserver_dir; 51 base::FilePath testserver_dir;
52 if (!PathService::Get(base::DIR_SOURCE_ROOT, &testserver_dir)) { 52 if (!PathService::Get(base::DIR_SOURCE_ROOT, &testserver_dir)) {
53 LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; 53 LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT";
54 return false; 54 return false;
55 } 55 }
56 testserver_dir = testserver_dir.Append(FILE_PATH_LITERAL("sync")) 56 testserver_dir = testserver_dir.Append(FILE_PATH_LITERAL("components"))
57 .Append(FILE_PATH_LITERAL("tools")) 57 .Append(FILE_PATH_LITERAL("sync"))
58 .Append(FILE_PATH_LITERAL("testserver")); 58 .Append(FILE_PATH_LITERAL("tools"))
59 .Append(FILE_PATH_LITERAL("testserver"));
59 60
60 *testserver_path = 61 *testserver_path =
61 testserver_dir.Append(FILE_PATH_LITERAL("sync_testserver.py")); 62 testserver_dir.Append(FILE_PATH_LITERAL("sync_testserver.py"));
62 return true; 63 return true;
63 } 64 }
64 65
65 bool LocalSyncTestServer::GetTestScriptPath( 66 bool LocalSyncTestServer::GetTestScriptPath(
66 const base::FilePath::StringType& test_script_name, 67 const base::FilePath::StringType& test_script_name,
67 base::FilePath* test_script_path) const { 68 base::FilePath* test_script_path) const {
68 base::FilePath testserver_path; 69 base::FilePath testserver_path;
(...skipping 16 matching lines...) Expand all
85 } 86 }
86 AppendToPythonPath(net_testserver_path.DirName()); 87 AppendToPythonPath(net_testserver_path.DirName());
87 88
88 // Locate the Python code generated by the sync protocol buffers compiler. 89 // Locate the Python code generated by the sync protocol buffers compiler.
89 base::FilePath pyproto_dir; 90 base::FilePath pyproto_dir;
90 if (!GetPyProtoPath(&pyproto_dir)) { 91 if (!GetPyProtoPath(&pyproto_dir)) {
91 LOG(WARNING) << "Cannot find pyproto dir for generated code. " 92 LOG(WARNING) << "Cannot find pyproto dir for generated code. "
92 << "Testserver features that rely on it will not work"; 93 << "Testserver features that rely on it will not work";
93 return true; 94 return true;
94 } 95 }
95 AppendToPythonPath(pyproto_dir.AppendASCII("sync").AppendASCII("protocol")); 96 AppendToPythonPath(pyproto_dir.AppendASCII("components")
97 .AppendASCII("sync")
98 .AppendASCII("protocol"));
96 return true; 99 return true;
97 } 100 }
98 101
99 } // namespace syncer 102 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/test/local_sync_test_server.h ('k') | components/sync/test/mock_invalidation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698