Index: ui/base/clipboard/clipboard_unittest.cc |
diff --git a/ui/base/clipboard/clipboard_unittest.cc b/ui/base/clipboard/clipboard_unittest.cc |
index 5ddec420e180aae395fca493fa3f42d1a0f77fd6..3875bd76b39ba2b7d5804e0f1290564f42c5d982 100644 |
--- a/ui/base/clipboard/clipboard_unittest.cc |
+++ b/ui/base/clipboard/clipboard_unittest.cc |
@@ -10,6 +10,7 @@ |
#include "base/memory/scoped_ptr.h" |
#include "base/message_loop/message_loop.h" |
#include "base/pickle.h" |
+#include "base/run_loop.h" |
#include "base/strings/string_util.h" |
#include "base/strings/utf_string_conversions.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -717,6 +718,28 @@ TEST_F(ClipboardTest, WriteEverything) { |
// Passes if we don't crash. |
} |
+// Simple test that the sequence number appears to change when the clipboard is |
+// written to. |
+// TODO(dcheng): Add a version to test CLIPBOARD_TYPE_SELECTION. |
+TEST_F(ClipboardTest, GetSequenceNumber) { |
+ const uint64 first_sequence_number = |
+ clipboard().GetSequenceNumber(CLIPBOARD_TYPE_COPY_PASTE); |
+ |
+ { |
+ ScopedClipboardWriter writer(&clipboard(), CLIPBOARD_TYPE_COPY_PASTE); |
+ writer.WriteText(UTF8ToUTF16("World")); |
+ } |
+ |
+ // On some platforms, the sequence number is updated by a UI callback so pump |
+ // the message loop to make sure we get the notification. |
+ base::RunLoop().RunUntilIdle(); |
+ |
+ const uint64 second_sequence_number = |
+ clipboard().GetSequenceNumber(CLIPBOARD_TYPE_COPY_PASTE); |
+ |
+ EXPECT_NE(first_sequence_number, second_sequence_number); |
raymes
2014/01/14 02:55:47
It might be worth checking the case that I fixed (
|
+} |
+ |
#if defined(OS_ANDROID) |
// Test that if another application writes some text to the pasteboard the |