| 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/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 8 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 ExtensionApiNewTabTest() {} | 40 ExtensionApiNewTabTest() {} |
| 41 void SetUpCommandLine(base::CommandLine* command_line) override { | 41 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 42 ExtensionApiTest::SetUpCommandLine(command_line); | 42 ExtensionApiTest::SetUpCommandLine(command_line); |
| 43 // Override the default which InProcessBrowserTest adds if it doesn't see a | 43 // Override the default which InProcessBrowserTest adds if it doesn't see a |
| 44 // homepage. | 44 // homepage. |
| 45 command_line->AppendSwitchASCII( | 45 command_line->AppendSwitchASCII( |
| 46 switches::kHomePage, chrome::kChromeUINewTabURL); | 46 switches::kHomePage, chrome::kChromeUINewTabURL); |
| 47 } | 47 } |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 class ExtensionApiTabAudioMutingTest : public ExtensionApiTest { |
| 51 public: |
| 52 ExtensionApiTabAudioMutingTest() {} |
| 53 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 54 ExtensionApiTest::SetUpCommandLine(command_line); |
| 55 |
| 56 command_line->AppendSwitch(switches::kEnableTabAudioMuting); |
| 57 } |
| 58 }; |
| 59 |
| 50 IN_PROC_BROWSER_TEST_F(ExtensionApiNewTabTest, Tabs) { | 60 IN_PROC_BROWSER_TEST_F(ExtensionApiNewTabTest, Tabs) { |
| 51 // The test creates a tab and checks that the URL of the new tab | 61 // The test creates a tab and checks that the URL of the new tab |
| 52 // is that of the new tab page. Make sure the pref that controls | 62 // is that of the new tab page. Make sure the pref that controls |
| 53 // this is set. | 63 // this is set. |
| 54 browser()->profile()->GetPrefs()->SetBoolean( | 64 browser()->profile()->GetPrefs()->SetBoolean( |
| 55 prefs::kHomePageIsNewTabPage, true); | 65 prefs::kHomePageIsNewTabPage, true); |
| 56 | 66 |
| 57 ASSERT_TRUE(RunExtensionSubtest("tabs/basics", "crud.html")) << message_; | 67 ASSERT_TRUE(RunExtensionSubtest("tabs/basics", "crud.html")) << message_; |
| 58 } | 68 } |
| 59 | 69 |
| 70 IN_PROC_BROWSER_TEST_F(ExtensionApiTabAudioMutingTest, TabAudible) { |
| 71 ASSERT_TRUE(RunExtensionSubtest("tabs/basics", "audible.html")) << message_; |
| 72 } |
| 73 |
| 74 IN_PROC_BROWSER_TEST_F(ExtensionApiTabAudioMutingTest, TabMuted) { |
| 75 ASSERT_TRUE(RunExtensionSubtest("tabs/basics", "muted.html")) << message_; |
| 76 } |
| 77 |
| 60 // Flaky on windows: http://crbug.com/238667 | 78 // Flaky on windows: http://crbug.com/238667 |
| 61 #if defined(OS_WIN) | 79 #if defined(OS_WIN) |
| 62 #define MAYBE_Tabs2 DISABLED_Tabs2 | 80 #define MAYBE_Tabs2 DISABLED_Tabs2 |
| 63 #else | 81 #else |
| 64 #define MAYBE_Tabs2 Tabs2 | 82 #define MAYBE_Tabs2 Tabs2 |
| 65 #endif | 83 #endif |
| 66 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Tabs2) { | 84 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Tabs2) { |
| 67 ASSERT_TRUE(RunExtensionSubtest("tabs/basics", "crud2.html")) << message_; | 85 ASSERT_TRUE(RunExtensionSubtest("tabs/basics", "crud2.html")) << message_; |
| 68 } | 86 } |
| 69 | 87 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 << message_; | 268 << message_; |
| 251 } | 269 } |
| 252 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_GetViewsOfCreatedWindow) { | 270 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_GetViewsOfCreatedWindow) { |
| 253 ASSERT_TRUE(RunExtensionSubtest("tabs/basics", "get_views_window.html")) | 271 ASSERT_TRUE(RunExtensionSubtest("tabs/basics", "get_views_window.html")) |
| 254 << message_; | 272 << message_; |
| 255 } | 273 } |
| 256 | 274 |
| 257 // Adding a new test? Awesome. But API tests are the old hotness. The new | 275 // Adding a new test? Awesome. But API tests are the old hotness. The new |
| 258 // hotness is extension_function_test_utils. See tabs_test.cc for an example. | 276 // hotness is extension_function_test_utils. See tabs_test.cc for an example. |
| 259 // We are trying to phase out many uses of API tests as they tend to be flaky. | 277 // We are trying to phase out many uses of API tests as they tend to be flaky. |
| OLD | NEW |