[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / content / public / test / test_web_ui.cc
bloba0017bfd8b36e33c0b91e1764c1a1fec8d2aa687
1 // Copyright 2015 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.
5 #include "base/logging.h"
6 #include "content/public/browser/web_ui_message_handler.h"
7 #include "content/public/test/test_web_ui.h"
9 namespace content {
11 TestWebUI::TestWebUI() : web_contents_(nullptr) {
14 TestWebUI::~TestWebUI() {
15 ClearTrackedCalls();
18 void TestWebUI::ClearTrackedCalls() {
19 call_data_.clear();
22 WebContents* TestWebUI::GetWebContents() const {
23 return web_contents_;
26 WebUIController* TestWebUI::GetController() const {
27 return nullptr;
30 float TestWebUI::GetDeviceScaleFactor() const {
31 return 1.0f;
34 const base::string16& TestWebUI::GetOverriddenTitle() const {
35 return temp_string_;
38 ui::PageTransition TestWebUI::GetLinkTransitionType() const {
39 return ui::PAGE_TRANSITION_LINK;
42 int TestWebUI::GetBindings() const {
43 return 0;
46 void TestWebUI::AddMessageHandler(WebUIMessageHandler* handler) {
47 handlers_.push_back(handler);
50 void TestWebUI::CallJavascriptFunction(const std::string& function_name) {
51 call_data_.push_back(new CallData(function_name));
54 void TestWebUI::CallJavascriptFunction(const std::string& function_name,
55 const base::Value& arg1) {
56 call_data_.push_back(new CallData(function_name));
57 call_data_.back()->TakeAsArg1(arg1.DeepCopy());
60 void TestWebUI::CallJavascriptFunction(const std::string& function_name,
61 const base::Value& arg1,
62 const base::Value& arg2) {
63 call_data_.push_back(new CallData(function_name));
64 call_data_.back()->TakeAsArg1(arg1.DeepCopy());
65 call_data_.back()->TakeAsArg2(arg2.DeepCopy());
68 void TestWebUI::CallJavascriptFunction(const std::string& function_name,
69 const base::Value& arg1,
70 const base::Value& arg2,
71 const base::Value& arg3) {
72 NOTREACHED();
75 void TestWebUI::CallJavascriptFunction(const std::string& function_name,
76 const base::Value& arg1,
77 const base::Value& arg2,
78 const base::Value& arg3,
79 const base::Value& arg4) {
80 NOTREACHED();
83 void TestWebUI::CallJavascriptFunction(
84 const std::string& function_name,
85 const std::vector<const base::Value*>& args) {
86 NOTREACHED();
89 TestWebUI::CallData::CallData(const std::string& function_name)
90 : function_name_(function_name) {
93 TestWebUI::CallData::~CallData() {
96 void TestWebUI::CallData::TakeAsArg1(base::Value* arg) {
97 arg1_.reset(arg);
100 void TestWebUI::CallData::TakeAsArg2(base::Value* arg) {
101 arg2_.reset(arg);
104 } // namespace content