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/strings/string_number_conversions.h" | 5 #include "base/strings/string_number_conversions.h" |
6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/extensions/api/notifications/notifications_api.h" | 9 #include "chrome/browser/extensions/api/notifications/notifications_api.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 private: | 61 private: |
62 void Observe(int type, | 62 void Observe(int type, |
63 const content::NotificationSource& source, | 63 const content::NotificationSource& source, |
64 const content::NotificationDetails& details) override { | 64 const content::NotificationDetails& details) override { |
65 results_.push_back( | 65 results_.push_back( |
66 static_cast<content::Source<extensions::TestSendMessageFunction> >( | 66 static_cast<content::Source<extensions::TestSendMessageFunction> >( |
67 source) | 67 source) |
68 .ptr() | 68 .ptr() |
69 ->user_gesture()); | 69 ->user_gesture()); |
70 if (waiting_) | 70 if (waiting_) |
71 base::MessageLoopForUI::current()->Quit(); | 71 base::MessageLoopForUI::current()->QuitWhenIdle(); |
72 } | 72 } |
73 | 73 |
74 content::NotificationRegistrar registrar_; | 74 content::NotificationRegistrar registrar_; |
75 | 75 |
76 // A sequential list of user gesture notifications from the test extension(s). | 76 // A sequential list of user gesture notifications from the test extension(s). |
77 std::deque<bool> results_; | 77 std::deque<bool> results_; |
78 | 78 |
79 // True if we're in a nested message loop waiting for results from | 79 // True if we're in a nested message loop waiting for results from |
80 // the extension. | 80 // the extension. |
81 bool waiting_; | 81 bool waiting_; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 notification->ButtonClick(0); | 282 notification->ButtonClick(0); |
283 EXPECT_TRUE(catcher.GetNextResult()); | 283 EXPECT_TRUE(catcher.GetNextResult()); |
284 notification->Click(); | 284 notification->Click(); |
285 EXPECT_TRUE(catcher.GetNextResult()); | 285 EXPECT_TRUE(catcher.GetNextResult()); |
286 notification->Close(true); | 286 notification->Close(true); |
287 EXPECT_TRUE(catcher.GetNextResult()); | 287 EXPECT_TRUE(catcher.GetNextResult()); |
288 notification->Close(false); | 288 notification->Close(false); |
289 EXPECT_FALSE(catcher.GetNextResult()); | 289 EXPECT_FALSE(catcher.GetNextResult()); |
290 } | 290 } |
291 } | 291 } |
OLD | NEW |