OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
6 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 6 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
7 #include "chrome/common/chrome_switches.h" | 7 #include "chrome/common/chrome_switches.h" |
8 #include "content/public/browser/render_widget_host.h" | 8 #include "content/public/browser/render_widget_host.h" |
9 #include "content/public/browser/render_widget_host_view.h" | 9 #include "content/public/browser/render_widget_host_view.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 | 14 |
15 class AutomationApiTest : public ExtensionApiTest { | 15 class AutomationApiTest : public ExtensionApiTest { |
16 public: | 16 public: |
17 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 17 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
18 ExtensionApiTest::SetUpCommandLine(command_line); | 18 ExtensionApiTest::SetUpCommandLine(command_line); |
19 command_line->AppendSwitch(::switches::kEnableAutomationAPI); | 19 command_line->AppendSwitch(::switches::kEnableAutomationAPI); |
20 } | 20 } |
21 | 21 |
22 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 22 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
23 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | 23 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
24 } | 24 } |
25 }; | 25 }; |
26 | 26 |
27 IN_PROC_BROWSER_TEST_F(AutomationApiTest, SanityCheck) { | 27 // TODO(dtseng): See crbug.com/360297. |
| 28 #if defined(OS_MACOSX) |
| 29 #define MAYBE_SanityCheck DISABLED_SanityCheck |
| 30 #else |
| 31 #define MAYBE_SanityCheck SanityCheck |
| 32 #endif // defined(OS_MACOSX) |
| 33 IN_PROC_BROWSER_TEST_F(AutomationApiTest, MAYBE_SanityCheck) { |
28 ASSERT_EQ(1, browser()->tab_strip_model()->count()); | 34 ASSERT_EQ(1, browser()->tab_strip_model()->count()); |
29 content::WebContents* const tab = | 35 content::WebContents* const tab = |
30 browser()->tab_strip_model()->GetWebContentsAt(0); | 36 browser()->tab_strip_model()->GetWebContentsAt(0); |
31 content::RenderWidgetHost* rwh = | 37 content::RenderWidgetHost* rwh = |
32 tab->GetRenderWidgetHostView()->GetRenderWidgetHost(); | 38 tab->GetRenderWidgetHostView()->GetRenderWidgetHost(); |
33 ASSERT_NE((content::RenderWidgetHost*)NULL, rwh) | 39 ASSERT_NE((content::RenderWidgetHost*)NULL, rwh) |
34 << "Couldn't get RenderWidgetHost"; | 40 << "Couldn't get RenderWidgetHost"; |
35 ASSERT_FALSE(rwh->IsFullAccessibilityModeForTesting()); | 41 ASSERT_FALSE(rwh->IsFullAccessibilityModeForTesting()); |
36 ASSERT_FALSE(rwh->IsTreeOnlyAccessibilityModeForTesting()); | 42 ASSERT_FALSE(rwh->IsTreeOnlyAccessibilityModeForTesting()); |
37 | 43 |
38 ASSERT_TRUE(RunComponentExtensionTest("automation/sanity_check")) << message_; | 44 ASSERT_TRUE(RunComponentExtensionTest("automation/sanity_check")) << message_; |
39 | 45 |
40 rwh = tab->GetRenderWidgetHostView()->GetRenderWidgetHost(); | 46 rwh = tab->GetRenderWidgetHostView()->GetRenderWidgetHost(); |
41 ASSERT_NE((content::RenderWidgetHost*)NULL, rwh) | 47 ASSERT_NE((content::RenderWidgetHost*)NULL, rwh) |
42 << "Couldn't get RenderWidgetHost"; | 48 << "Couldn't get RenderWidgetHost"; |
43 ASSERT_FALSE(rwh->IsFullAccessibilityModeForTesting()); | 49 ASSERT_FALSE(rwh->IsFullAccessibilityModeForTesting()); |
44 ASSERT_TRUE(rwh->IsTreeOnlyAccessibilityModeForTesting()); | 50 ASSERT_TRUE(rwh->IsTreeOnlyAccessibilityModeForTesting()); |
45 } | 51 } |
46 | 52 |
47 } // namespace extensions | 53 } // namespace extensions |
OLD | NEW |