Home | History | Annotate | Download | only in integration
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_DICTIONARY_HELPER_H_
      6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_DICTIONARY_HELPER_H_
      7 
      8 #include <string>
      9 
     10 #include "base/command_line.h"
     11 
     12 class SpellcheckCustomDictionary;
     13 
     14 namespace dictionary_helper {
     15 
     16 // Synchronously loads the dictionaries across all profiles. Also loads the
     17 // dictionary for the verifier if DisableVerifier() hasn't been called. Returns
     18 // only after the dictionaries have finished to load.
     19 void LoadDictionaries();
     20 
     21 // Used to check the size of the dictionary within a particular sync profile.
     22 size_t GetDictionarySize(int index);
     23 
     24 // Used to check the size of the dictionary within the verifier sync profile.
     25 size_t GetVerifierDictionarySize();
     26 
     27 // Used to verify that dictionaries match across all profiles. Also checks
     28 // verifier if DisableVerifier() hasn't been called.
     29 bool DictionariesMatch();
     30 
     31 // Waits until dictionaries match across all platforms.  Returns false
     32 // if this operation times out.
     33 bool AwaitDictionariesMatch();
     34 
     35 // Waits until the profile at the given index contains exactly |num| dictionary
     36 // entries.  Returns false if this operation times out.
     37 bool AwaitNumDictionaryEntries(int index, size_t num_words);
     38 
     39 // Used to verify that the dictionary within a particular sync profile matches
     40 // the dictionary within the verifier sync profile.
     41 bool DictionaryMatchesVerifier(int index);
     42 
     43 // Adds |word| to the dictionary for profile with index |index|. Also adds
     44 // |word| to the verifier if DisableVerifier() hasn't been called. Returns true
     45 // if |word| is valid and not a duplicate. Otherwise returns false.
     46 bool AddWord(int index, const std::string& word);
     47 
     48 // Removes |word| from the dictionary for profile with index |index|. Also
     49 // removes |word| from the verifier if DisableVerifier() hasn't been called.
     50 // Returns true if |word| was found. Otherwise returns false.
     51 bool RemoveWord(int index, const std::string& word);
     52 
     53 }  // namespace dictionary_helper
     54 
     55 #endif  // CHROME_BROWSER_SYNC_TEST_INTEGRATION_DICTIONARY_HELPER_H_
     56