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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 Profile* profile_; | 65 Profile* profile_; |
66 content::NotificationRegistrar registrar_; | 66 content::NotificationRegistrar registrar_; |
67 scoped_ptr<LazyBackgroundObserver> original_complete_; | 67 scoped_ptr<LazyBackgroundObserver> original_complete_; |
68 scoped_ptr<LazyBackgroundObserver> incognito_complete_; | 68 scoped_ptr<LazyBackgroundObserver> incognito_complete_; |
69 }; | 69 }; |
70 | 70 |
71 } // namespace | 71 } // namespace |
72 | 72 |
73 class LazyBackgroundPageApiTest : public ExtensionApiTest { | 73 class LazyBackgroundPageApiTest : public ExtensionApiTest { |
74 public: | 74 public: |
75 void SetUpCommandLine(CommandLine* command_line) { | 75 void SetUpCommandLine(CommandLine* command_line) { |
76 ExtensionApiTest::SetUpCommandLine(command_line); | 76 ExtensionApiTest::SetUpCommandLine(command_line); |
77 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 77 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
78 // Set shorter delays to prevent test timeouts. | 78 // Set shorter delays to prevent test timeouts. |
79 command_line->AppendSwitchASCII(switches::kEventPageIdleTime, "1"); | 79 command_line->AppendSwitchASCII(switches::kEventPageIdleTime, "1"); |
80 command_line->AppendSwitchASCII(switches::kEventPageUnloadingTime, "1"); | 80 command_line->AppendSwitchASCII(switches::kEventPageUnloadingTime, "1"); |
81 } | 81 } |
82 | 82 |
83 // Loads the extension, which temporarily starts the lazy background page | 83 // Loads the extension, which temporarily starts the lazy background page |
84 // to dispatch the onInstalled event. We wait until it shuts down again. | 84 // to dispatch the onInstalled event. We wait until it shuts down again. |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); | 369 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); |
370 | 370 |
371 // The browser action has a new title. | 371 // The browser action has a new title. |
372 BrowserActionTestUtil browser_action(browser()); | 372 BrowserActionTestUtil browser_action(browser()); |
373 ASSERT_EQ(1, browser_action.NumberOfBrowserActions()); | 373 ASSERT_EQ(1, browser_action.NumberOfBrowserActions()); |
374 EXPECT_EQ("Success", browser_action.GetTooltip(0)); | 374 EXPECT_EQ("Success", browser_action.GetTooltip(0)); |
375 } | 375 } |
376 | 376 |
377 // TODO: background page with timer. | 377 // TODO: background page with timer. |
378 // TODO: background page that interacts with popup. | 378 // TODO: background page that interacts with popup. |
OLD | NEW |