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

Side by Side Diff: chrome/browser/chromeos/arc/extensions/fake_arc_support.h

Issue 2534883002: Extract ArcTermsOfServiceNegotiator implementation. (Closed)
Patch Set: Address comments. Created 4 years 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
OLDNEW
(Empty)
1 // Copyright 2016 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_CHROMEOS_ARC_EXTENSIONS_FAKE_ARC_SUPPORT_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_EXTENSIONS_FAKE_ARC_SUPPORT_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/chromeos/arc/arc_support_host.h"
14 #include "extensions/browser/api/messaging/native_message_host.h"
15
16 namespace arc {
17
18 // Fake implementation of ARC support Chrome App for testing.
19 class FakeArcSupport : public extensions::NativeMessageHost::Client {
20 public:
21 explicit FakeArcSupport(ArcSupportHost* support_host);
22 ~FakeArcSupport() override;
23
24 // Emulates to open ARC support Chrome app, and connect message host to
25 // ARC support host.
26 void Open(Profile* profile);
27
28 // Emulates clicking Close button.
29 void Close();
30
31 // Terms of service page emulation.
32 // Emulates clicking Agree button.
33 void ClickAgreeButton();
34
35 // Emulates checking preference box.
36 void set_metrics_mode(bool mode) { metrics_mode_ = mode; }
37 void set_backup_and_restore_mode(bool mode) {
38 backup_and_restore_mode_ = mode;
39 }
40 void set_location_service_mode(bool mode) { location_service_mode_ = mode; }
41
42 // Error page emulation.
43 void ClickRetryButton();
44
45 // Returns the current page.
46 ArcSupportHost::UIPage ui_page() const { return ui_page_; }
47
48 private:
49 // extensions::NativeMessageHost::Client:
50 void PostMessageFromNativeHost(const std::string& message) override;
51 void CloseChannel(const std::string& error_message) override;
52
53 ArcSupportHost* support_host_;
Luis Héctor Chávez 2016/11/29 18:18:12 nit: ArcSupportHost* const support_host_;
hidehiko 2016/12/01 14:20:09 Done.
54
55 std::unique_ptr<extensions::NativeMessageHost> native_message_host_;
56 ArcSupportHost::UIPage ui_page_ = ArcSupportHost::UIPage::NO_PAGE;
57 bool metrics_mode_ = false;
58 bool backup_and_restore_mode_ = false;
59 bool location_service_mode_ = false;
60
61 base::WeakPtrFactory<FakeArcSupport> weak_ptr_factory_;
62
63 DISALLOW_COPY_AND_ASSIGN(FakeArcSupport);
64 };
65
66 } // namespace arc
67
68 #endif // CHROME_BROWSER_CHROMEOS_ARC_EXTENSIONS_FAKE_ARC_SUPPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698