diff options
author | ivankr@chromium.org <ivankr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-09 11:04:55 +0000 |
---|---|---|
committer | ivankr@chromium.org <ivankr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-09 11:04:55 +0000 |
commit | 7d21a6b37c15011033601f49150e280c2417ce1d (patch) | |
tree | 8a893f4b29f773643df8bdef5102b77cf55627a8 /rlz/test | |
parent | c80ca12f3e74e8d54653c312bbd3c92afd0fee55 (diff) | |
download | chromium_src-7d21a6b37c15011033601f49150e280c2417ce1d.zip chromium_src-7d21a6b37c15011033601f49150e280c2417ce1d.tar.gz chromium_src-7d21a6b37c15011033601f49150e280c2417ce1d.tar.bz2 |
[cros] RlzValueStore implementation for ChromeOS.
BUG=157348
TEST=rlz_unittests
Review URL: https://chromiumcodereview.appspot.com/11365107
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166891 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'rlz/test')
-rw-r--r-- | rlz/test/rlz_test_helpers.cc | 27 | ||||
-rw-r--r-- | rlz/test/rlz_test_helpers.h | 15 |
2 files changed, 37 insertions, 5 deletions
diff --git a/rlz/test/rlz_test_helpers.cc b/rlz/test/rlz_test_helpers.cc index 1a1870a..4fe12d4 100644 --- a/rlz/test/rlz_test_helpers.cc +++ b/rlz/test/rlz_test_helpers.cc @@ -13,10 +13,13 @@ #include <shlwapi.h> #include "base/win/registry.h" #include "rlz/win/lib/rlz_lib.h" -#elif defined(OS_MACOSX) +#elif defined(OS_MACOSX) || defined(OS_CHROMEOS) #include "base/file_path.h" #include "rlz/lib/rlz_value_store.h" #endif +#if defined(OS_CHROMEOS) +#include "rlz/chromeos/lib/rlz_value_store_chromeos.h" +#endif #if defined(OS_WIN) namespace { @@ -60,22 +63,40 @@ void UndoOverrideRegistryHives() { #endif // defined(OS_WIN) +#if defined(OS_CHROMEOS) +RlzLibTestNoMachineState::RlzLibTestNoMachineState() + : pref_store_io_thread_("test_rlz_pref_store_io_thread") { +} +#endif // defined(OS_CHROMEOS) + void RlzLibTestNoMachineState::SetUp() { #if defined(OS_WIN) OverrideRegistryHives(); #elif defined(OS_MACOSX) base::mac::ScopedNSAutoreleasePool pool; +#endif // defined(OS_WIN) +#if defined(OS_MACOSX) || defined(OS_CHROMEOS) ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); rlz_lib::testing::SetRlzStoreDirectory(temp_dir_.path()); -#endif // defined(OS_WIN) +#endif // defined(OS_MACOSX) || defined(OS_CHROMEOS) +#if defined(OS_CHROMEOS) + base::Thread::Options options; + options.message_loop_type = MessageLoop::TYPE_IO; + ASSERT_TRUE(pref_store_io_thread_.StartWithOptions(options)); + rlz_lib::SetIOTaskRunner(pref_store_io_thread_.message_loop_proxy()); + rlz_lib::RlzValueStoreChromeOS::ResetForTesting(); +#endif // defined(OS_CHROMEOS) } void RlzLibTestNoMachineState::TearDown() { #if defined(OS_WIN) UndoOverrideRegistryHives(); -#elif defined(OS_MACOSX) +#elif defined(OS_MACOSX) || defined(OS_CHROMEOS) rlz_lib::testing::SetRlzStoreDirectory(FilePath()); #endif // defined(OS_WIN) +#if defined(OS_CHROMEOS) + pref_store_io_thread_.Stop(); +#endif // defined(OS_CHROMEOS) } void RlzLibTestBase::SetUp() { diff --git a/rlz/test/rlz_test_helpers.h b/rlz/test/rlz_test_helpers.h index 66bb525..6ca606d 100644 --- a/rlz/test/rlz_test_helpers.h +++ b/rlz/test/rlz_test_helpers.h @@ -10,19 +10,30 @@ #include "base/compiler_specific.h" #include "testing/gtest/include/gtest/gtest.h" -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) || defined(OS_CHROMEOS) #include "base/scoped_temp_dir.h" #endif +#if defined(OS_CHROMEOS) +#include "base/message_loop.h" +#include "base/threading/thread.h" +#endif class RlzLibTestNoMachineState : public ::testing::Test { protected: +#if defined(OS_CHROMEOS) + RlzLibTestNoMachineState(); +#endif virtual void SetUp() OVERRIDE; virtual void TearDown() OVERRIDE; -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) || defined(OS_CHROMEOS) ScopedTempDir temp_dir_; #endif +#if defined(OS_CHROMEOS) + base::Thread pref_store_io_thread_; + MessageLoop message_loop_; +#endif }; class RlzLibTestBase : public RlzLibTestNoMachineState { |