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

Side by Side Diff: chrome/browser/extensions/api/system_private/system_private_apitest.cc

Issue 477663004: Merged FakedDBusThreadManager with DBusThreadManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "base/prefs/pref_service.h" 5 #include "base/prefs/pref_service.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/common/pref_names.h" 9 #include "chrome/common/pref_names.h"
10 10
11 #if defined(OS_CHROMEOS) 11 #if defined(OS_CHROMEOS)
12 #include "chromeos/dbus/fake_dbus_thread_manager.h" 12 #include "chromeos/dbus/dbus_thread_manager.h"
13 #include "chromeos/dbus/fake_update_engine_client.h" 13 #include "chromeos/dbus/fake_update_engine_client.h"
14 14
15 using chromeos::UpdateEngineClient; 15 using chromeos::UpdateEngineClient;
16 #endif 16 #endif
17 17
18 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, GetIncognitoModeAvailability) { 18 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, GetIncognitoModeAvailability) {
19 PrefService* pref_service = browser()->profile()->GetPrefs(); 19 PrefService* pref_service = browser()->profile()->GetPrefs();
20 pref_service->SetInteger(prefs::kIncognitoModeAvailability, 1); 20 pref_service->SetInteger(prefs::kIncognitoModeAvailability, 1);
21 21
22 EXPECT_TRUE(RunComponentExtensionTest( 22 EXPECT_TRUE(RunComponentExtensionTest(
23 "system/get_incognito_mode_availability")) << message_; 23 "system/get_incognito_mode_availability")) << message_;
24 } 24 }
25 25
26 #if defined(OS_CHROMEOS) 26 #if defined(OS_CHROMEOS)
27 27
28 class GetUpdateStatusApiTest : public ExtensionApiTest { 28 class GetUpdateStatusApiTest : public ExtensionApiTest {
29 public: 29 public:
30 GetUpdateStatusApiTest() : fake_update_engine_client_(NULL) {} 30 GetUpdateStatusApiTest() : fake_update_engine_client_(NULL) {}
31 31
32 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 32 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
33 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); 33 ExtensionApiTest::SetUpInProcessBrowserTestFixture();
34 chromeos::FakeDBusThreadManager* fake_dbus_thread_manager =
35 new chromeos::FakeDBusThreadManager;
36 fake_dbus_thread_manager->SetFakeClients();
37 fake_update_engine_client_ = new chromeos::FakeUpdateEngineClient; 34 fake_update_engine_client_ = new chromeos::FakeUpdateEngineClient;
38 fake_dbus_thread_manager->SetUpdateEngineClient( 35 chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient(
39 scoped_ptr<UpdateEngineClient>(fake_update_engine_client_)); 36 scoped_ptr<UpdateEngineClient>(fake_update_engine_client_));
40 chromeos::DBusThreadManager::SetInstanceForTesting(
41 fake_dbus_thread_manager);
42 } 37 }
43 38
44 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { 39 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE {
45 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); 40 ExtensionApiTest::TearDownInProcessBrowserTestFixture();
46 } 41 }
47 42
48 protected: 43 protected:
49 chromeos::FakeUpdateEngineClient* fake_update_engine_client_; 44 chromeos::FakeUpdateEngineClient* fake_update_engine_client_;
50 45
51 private: 46 private:
(...skipping 13 matching lines...) Expand all
65 // The fake client returns the last status in this order. 60 // The fake client returns the last status in this order.
66 fake_update_engine_client_->PushLastStatus(status_not_available); 61 fake_update_engine_client_->PushLastStatus(status_not_available);
67 fake_update_engine_client_->PushLastStatus(status_updating); 62 fake_update_engine_client_->PushLastStatus(status_updating);
68 fake_update_engine_client_->PushLastStatus(status_boot_needed); 63 fake_update_engine_client_->PushLastStatus(status_boot_needed);
69 64
70 ASSERT_TRUE(RunComponentExtensionTest( 65 ASSERT_TRUE(RunComponentExtensionTest(
71 "system/get_update_status")) << message_; 66 "system/get_update_status")) << message_;
72 } 67 }
73 68
74 #endif 69 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698