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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/extensions/app_notify_channel_setup.h" | 6 #include "chrome/browser/extensions/app_notify_channel_setup.h" |
7 #include "chrome/browser/extensions/extension_browsertest.h" | 7 #include "chrome/browser/extensions/extension_browsertest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.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" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
13 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 | 15 |
16 using content::BrowserThread; | 16 using content::BrowserThread; |
17 | 17 |
18 class AppNotificationTest : public ExtensionBrowserTest { | 18 class AppNotificationTest : public ExtensionBrowserTest {}; |
19 public: | |
20 void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
21 ExtensionBrowserTest::SetUpCommandLine(command_line); | |
22 command_line->AppendSwitch( | |
23 switches::kEnableExperimentalExtensionApis); | |
24 } | |
25 }; | |
26 | 19 |
27 namespace { | 20 namespace { |
28 | 21 |
29 // Our test app will call the getNotificationChannel API using this client id. | 22 // Our test app will call the getNotificationChannel API using this client id. |
30 static const char* kExpectedClientId = "dummy_client_id"; | 23 static const char* kExpectedClientId = "dummy_client_id"; |
31 | 24 |
32 class Interceptor : public AppNotifyChannelSetup::InterceptorForTests { | 25 class Interceptor : public AppNotifyChannelSetup::InterceptorForTests { |
33 public: | 26 public: |
34 Interceptor() : was_called_(false) {} | 27 Interceptor() : was_called_(false) {} |
35 virtual ~Interceptor() {} | 28 virtual ~Interceptor() {} |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 NEW_FOREGROUND_TAB); | 64 NEW_FOREGROUND_TAB); |
72 if (!interceptor.was_called()) | 65 if (!interceptor.was_called()) |
73 ui_test_utils::RunMessageLoop(); | 66 ui_test_utils::RunMessageLoop(); |
74 EXPECT_TRUE(interceptor.was_called()); | 67 EXPECT_TRUE(interceptor.was_called()); |
75 | 68 |
76 ExtensionService* service = browser()->profile()->GetExtensionService(); | 69 ExtensionService* service = browser()->profile()->GetExtensionService(); |
77 ExtensionPrefs* prefs = service->extension_prefs(); | 70 ExtensionPrefs* prefs = service->extension_prefs(); |
78 std::string saved_id = prefs->GetAppNotificationClientId(app->id()); | 71 std::string saved_id = prefs->GetAppNotificationClientId(app->id()); |
79 EXPECT_TRUE(std::string(kExpectedClientId) == saved_id); | 72 EXPECT_TRUE(std::string(kExpectedClientId) == saved_id); |
80 } | 73 } |
OLD | NEW |