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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
9 #include "chrome/browser/extensions/browser_action_test_util.h" | 9 #include "chrome/browser/extensions/browser_action_test_util.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 }; | 96 }; |
97 | 97 |
98 | 98 |
99 } // namespace | 99 } // namespace |
100 | 100 |
101 class LazyBackgroundPageApiTest : public ExtensionApiTest { | 101 class LazyBackgroundPageApiTest : public ExtensionApiTest { |
102 public: | 102 public: |
103 void SetUpCommandLine(CommandLine* command_line) { | 103 void SetUpCommandLine(CommandLine* command_line) { |
104 ExtensionApiTest::SetUpCommandLine(command_line); | 104 ExtensionApiTest::SetUpCommandLine(command_line); |
105 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 105 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
| 106 // Set shorter delays to prevent test timeouts. |
| 107 command_line->AppendSwitchASCII(switches::kEventPageIdleTime, "1"); |
| 108 command_line->AppendSwitchASCII(switches::kEventPageUnloadingTime, "1"); |
106 } | 109 } |
107 | 110 |
108 // Loads the extension, which temporarily starts the lazy background page | 111 // Loads the extension, which temporarily starts the lazy background page |
109 // to dispatch the onInstalled event. We wait until it shuts down again. | 112 // to dispatch the onInstalled event. We wait until it shuts down again. |
110 const Extension* LoadExtensionAndWait(const std::string& test_name) { | 113 const Extension* LoadExtensionAndWait(const std::string& test_name) { |
111 LazyBackgroundObserver page_complete; | 114 LazyBackgroundObserver page_complete; |
112 FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). | 115 FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). |
113 AppendASCII(test_name); | 116 AppendASCII(test_name); |
114 const Extension* extension = LoadExtension(extdir); | 117 const Extension* extension = LoadExtension(extdir); |
115 if (extension) | 118 if (extension) |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 382 |
380 // The browser action has a new title. | 383 // The browser action has a new title. |
381 BrowserActionTestUtil browser_action(browser()); | 384 BrowserActionTestUtil browser_action(browser()); |
382 ASSERT_EQ(1, browser_action.NumberOfBrowserActions()); | 385 ASSERT_EQ(1, browser_action.NumberOfBrowserActions()); |
383 EXPECT_EQ("Success", browser_action.GetTooltip(0)); | 386 EXPECT_EQ("Success", browser_action.GetTooltip(0)); |
384 } | 387 } |
385 | 388 |
386 // TODO: background page with timer. | 389 // TODO: background page with timer. |
387 // TODO: background page that interacts with popup. | 390 // TODO: background page that interacts with popup. |
388 // TODO: background page with menu. | 391 // TODO: background page with menu. |
OLD | NEW |