| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/options/core_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/core_options_handler.h" |
| 6 #include "chrome/common/url_constants.h" | 6 #include "chrome/common/url_constants.h" |
| 7 #include "chrome/test/ui_test_utils.h" | 7 #include "chrome/test/ui_test_utils.h" |
| 8 #include "content/browser/webui/web_ui_browsertest.h" | 8 #include "content/browser/webui/web_ui_browsertest.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 class SettingsWebUITest : public WebUIBrowserTest { | 67 class SettingsWebUITest : public WebUIBrowserTest { |
| 68 protected: | 68 protected: |
| 69 virtual WebUIMessageHandler* GetMockMessageHandler() { | 69 virtual WebUIMessageHandler* GetMockMessageHandler() { |
| 70 return &mock_core_options_handler_; | 70 return &mock_core_options_handler_; |
| 71 } | 71 } |
| 72 | 72 |
| 73 StrictMock<MockCoreOptionsHandler> mock_core_options_handler_; | 73 StrictMock<MockCoreOptionsHandler> mock_core_options_handler_; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 // Crashes on Mac only. http://crbug.com/77764 |
| 77 #if defined(OS_MACOSX) |
| 78 #define MAYBE_TestSetBooleanPrefTriggers DISABLED_TestSetBooleanPrefTriggers |
| 79 #else |
| 80 #define MAYBE_TestSetBooleanPrefTriggers TestSetBooleanPrefTriggers |
| 81 #endif |
| 76 // Test the end to end js to WebUI handler code path for | 82 // Test the end to end js to WebUI handler code path for |
| 77 // the message setBooleanPref. | 83 // the message setBooleanPref. |
| 78 // TODO(dtseng): add more EXPECT_CALL's when updating js test. | 84 // TODO(dtseng): add more EXPECT_CALL's when updating js test. |
| 79 IN_PROC_BROWSER_TEST_F(SettingsWebUITest, TestSetBooleanPrefTriggers) { | 85 IN_PROC_BROWSER_TEST_F(SettingsWebUITest, MAYBE_TestSetBooleanPrefTriggers) { |
| 80 // This serves as an example of a very constrained test. | 86 // This serves as an example of a very constrained test. |
| 81 ListValue true_list_value; | 87 ListValue true_list_value; |
| 82 true_list_value.Append(Value::CreateStringValue("browser.show_home_button")); | 88 true_list_value.Append(Value::CreateStringValue("browser.show_home_button")); |
| 83 true_list_value.Append(Value::CreateBooleanValue(true)); | 89 true_list_value.Append(Value::CreateBooleanValue(true)); |
| 84 true_list_value.Append( | 90 true_list_value.Append( |
| 85 Value::CreateStringValue("Options_Homepage_HomeButton")); | 91 Value::CreateStringValue("Options_Homepage_HomeButton")); |
| 86 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUISettingsURL)); | 92 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUISettingsURL)); |
| 87 EXPECT_CALL(mock_core_options_handler_, | 93 EXPECT_CALL(mock_core_options_handler_, |
| 88 HandleSetBooleanPref(Eq_ListValue(&true_list_value))); | 94 HandleSetBooleanPref(Eq_ListValue(&true_list_value))); |
| 89 ASSERT_TRUE(RunWebUITest( | 95 ASSERT_TRUE(RunWebUITest( |
| 90 FILE_PATH_LITERAL("settings_set_boolean_pref_triggers.js"))); | 96 FILE_PATH_LITERAL("settings_set_boolean_pref_triggers.js"))); |
| 91 } | 97 } |
| 92 | 98 |
| OLD | NEW |