| OLD | NEW |
| 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 "chrome/browser/chromeos/extensions/echo_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/echo_private_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "chrome/browser/chromeos/settings/cros_settings.h" | 10 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 command_line->AppendSwitch(switches::kStubCrosSettings); | 42 command_line->AppendSwitch(switches::kStubCrosSettings); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void RunDefaultGetUserFunctionAndExpectResultEquals(bool expected_result) { | 45 void RunDefaultGetUserFunctionAndExpectResultEquals(bool expected_result) { |
| 46 scoped_refptr<EchoPrivateGetUserConsentFunction> function( | 46 scoped_refptr<EchoPrivateGetUserConsentFunction> function( |
| 47 EchoPrivateGetUserConsentFunction::CreateForTest(base::Bind( | 47 EchoPrivateGetUserConsentFunction::CreateForTest(base::Bind( |
| 48 &ExtensionEchoPrivateApiTest::OnDialogShown, this))); | 48 &ExtensionEchoPrivateApiTest::OnDialogShown, this))); |
| 49 function->set_has_callback(true); | 49 function->set_has_callback(true); |
| 50 | 50 |
| 51 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 51 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
| 52 function, | 52 function.get(), |
| 53 "[{\"serviceName\":\"some_name\",\"origin\":\"http://chromium.org\"}]", | 53 "[{\"serviceName\":\"some_name\",\"origin\":\"http://chromium.org\"}]", |
| 54 browser())); | 54 browser())); |
| 55 | 55 |
| 56 ASSERT_TRUE(result.get()); | 56 ASSERT_TRUE(result.get()); |
| 57 ASSERT_EQ(base::Value::TYPE_BOOLEAN, result->GetType()); | 57 ASSERT_EQ(base::Value::TYPE_BOOLEAN, result->GetType()); |
| 58 | 58 |
| 59 bool result_as_boolean = false; | 59 bool result_as_boolean = false; |
| 60 ASSERT_TRUE(result->GetAsBoolean(&result_as_boolean)); | 60 ASSERT_TRUE(result->GetAsBoolean(&result_as_boolean)); |
| 61 | 61 |
| 62 EXPECT_EQ(expected_result, result_as_boolean); | 62 EXPECT_EQ(expected_result, result_as_boolean); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 expected_dialog_buttons_ = ui::DIALOG_BUTTON_CANCEL; | 173 expected_dialog_buttons_ = ui::DIALOG_BUTTON_CANCEL; |
| 174 dialog_action_ = DIALOG_TEST_ACTION_CANCEL; | 174 dialog_action_ = DIALOG_TEST_ACTION_CANCEL; |
| 175 | 175 |
| 176 RunDefaultGetUserFunctionAndExpectResultEquals(false); | 176 RunDefaultGetUserFunctionAndExpectResultEquals(false); |
| 177 | 177 |
| 178 EXPECT_EQ(1, dialog_invocation_count()); | 178 EXPECT_EQ(1, dialog_invocation_count()); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace chromeos | 181 } // namespace chromeos |
| OLD | NEW |