1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_
#define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_
#include <map>
#include <string>
#include "base/strings/string16.h"
class Profile;
class TemplateURL;
class TemplateURLService;
typedef std::map<std::string, const TemplateURL*> GUIDToTURLMap;
namespace search_engines_helper {
// Used to access the search engines within a particular sync profile.
TemplateURLService* GetServiceForBrowserContext(int profile_index);
// Used to access the search engines within the verifier sync profile.
TemplateURLService* GetVerifierService();
// Compared a single TemplateURLService for a given profile to the verifier.
// Retrns true iff their user-visible fields match.
bool ServiceMatchesVerifier(int profile_index);
// Returns true iff all TemplateURLServices match with the verifier.
bool AllServicesMatch();
// Create a TemplateURL with some test values based on |seed|. The caller owns
// the returned TemplateURL*.
TemplateURL* CreateTestTemplateURL(Profile* profile,
int seed,
const base::string16& keyword,
const std::string& sync_guid);
TemplateURL* CreateTestTemplateURL(Profile* profile,
int seed,
const base::string16& keyword,
const std::string& url,
const std::string& sync_guid);
// Add a search engine based on a seed to the service at index |profile_index|
// and the verifier if it is used.
void AddSearchEngine(int profile_index, int seed);
// Retrieves a search engine from the service at index |profile_index| with
// original keyword |keyword| and changes its user-visible fields. Does the same
// to the verifier, if it is used.
void EditSearchEngine(int profile_index,
const base::string16& keyword,
const base::string16& short_name,
const base::string16& new_keyword,
const std::string& url);
// Deletes a search engine from the service at index |profile_index| which was
// generated by seed |seed|.
void DeleteSearchEngineBySeed(int profile_index, int seed);
// Change the search engine generated with |seed| in service at index
// |profile_index| to be the new default. Does the same to the verifier, if it
// is used.
void ChangeDefaultSearchProvider(int profile_index, int seed);
} // namespace search_engines_helper
#endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_
|